I write a locust script to test a web site.
The script is very simple, just a request repeated several time.
In a virtual machine with Linux Mint and Python 2.7.6, the script works in the right way and as I want.
For example, I run the script without the Web Interface as write below:
locust --no-web -n 10 -c 1 -r 1 -f /path/to/file/file_test.py
and I obtain the right stats in the terminal window.
When I run the same script on another virtual machine with CentOS and Python 2.7.11, I obtain the following error:
[2016-05-20 12:26:03,954] nix/ERROR/stderr: Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/locust/core.py", line 267, in run
self.execute_next_task()
File "/usr/local/lib/python2.7/site-packages/locust/core.py", line 293, in execute_next_task
self.execute_task(task["callable"], *task["args"], **task["kwargs"])
File "/usr/local/lib/python2.7/site-packages/locust/core.py", line 305, in execute_task
task(self, *args, **kwargs)
File "/data/IVV/multi_benchmark/locust_scripts/OD_skip_top_multi_query.py", line 15, in query1
self.client.get(QUERY, verify=False)
File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 487, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python2.7/site-packages/locust/clients.py", line 113, in request
response = self._send_request_safe_mode(method, url, **kwargs)
File "/usr/local/lib/python2.7/site-packages/locust/clients.py", line 157, in _send_request_safe_mode
return requests.Session.request(self, method, url, **kwargs)
File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 475, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 585, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python2.7/site-packages/requests/adapters.py", line 403, in send
timeout=timeout
File "/usr/local/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 578, in urlopen
chunked=chunked)
File "/usr/local/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 351, in _make_request
self._validate_conn(conn)
File "/usr/local/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 814, in _validate_conn
conn.connect()
File "/usr/local/lib/python2.7/site-packages/requests/packages/urllib3/connection.py", line 289, in connect
ssl_version=resolved_ssl_version)
File "/usr/local/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py", line 308, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File "/usr/local/lib/python2.7/ssl.py", line 352, in wrap_socket
_context=self)
TypeError: __init__() got an unexpected keyword argument 'server_hostname'
[2016-05-20 12:26:04,911] nix/INFO/locust.runners: All locusts hatched: MyLocust: 1
[2016-05-20 12:26:04,911] nix/INFO/locust.runners: Resetting stats
Could you please help me understanding the problem?
Thanks very much.
It seems to be a known issue in urllib3, it has nothing to to with your scripts. See https://github.com/shazow/urllib3/issues/482
Related
I can install wheels but can't use "pip install 'module'", its like I just can't install those modules from the Internet.
Error
AttributeError: 'NoneType' object has no attribute 'startswith'
In spite of tensorflow, usual modules like "requests" or "numpy" can't be installed by pip.
C:\Users\Think>pip install tensorflow
Collecting tensorflow
Exception:
Traceback (most recent call last):
File "D:\Anaconda3\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "D:\Anaconda3\lib\site-packages\pip\commands\install.py", line 335, in
run
wb.build(autobuilding=True)
File "D:\Anaconda3\lib\site-packages\pip\wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "D:\Anaconda3\lib\site-packages\pip\req\req_set.py", line 380, in
prepare_files
ignore_dependencies=self.ignore_dependencies))
File "D:\Anaconda3\lib\site-packages\pip\req\req_set.py", line 554, in
_prepare_file
require_hashes
File "D:\Anaconda3\lib\site-packages\pip\req\req_install.py", line 278, in
populate_link
self.link = finder.find_requirement(self, upgrade)
File "D:\Anaconda3\lib\site-packages\pip\index.py", line 465, in
find_requirement
all_candidates = self.find_all_candidates(req.name)
File "D:\Anaconda3\lib\site-packages\pip\index.py", line 423, in
find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "D:\Anaconda3\lib\site-packages\pip\index.py", line 568, in _get_pages
page = self._get_page(location)
File "D:\Anaconda3\lib\site-packages\pip\index.py", line 683, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "D:\Anaconda3\lib\site-packages\pip\index.py", line 792, in get_page
"Cache-Control": "max-age=600",
File "D:\Anaconda3\lib\site-packages\pip\_vendor\requests\sessions.py", line
488, in get
return self.request('GET', url, **kwargs)
File "D:\Anaconda3\lib\site-packages\pip\download.py", line 386, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "D:\Anaconda3\lib\site-packages\pip\_vendor\requests\sessions.py", line
475, in request
resp = self.send(prep, **send_kwargs)
File "D:\Anaconda3\lib\site-packages\pip\_vendor\requests\sessions.py", line
596, in send
r = adapter.send(request, **kwargs)
File "D:\Anaconda3\lib\site-packages\pip\_vendor\cachecontrol\adapter.py",
line 47, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "D:\Anaconda3\lib\site-packages\pip\_vendor\requests\adapters.py",
line 423, in send
timeout=timeout
File "D:\Anaconda3\lib\site-
packages\pip\_vendor\requests\packages\urllib3\connectionpool.py", line
589, in urlopen
self._prepare_proxy(conn)
File "D:\Anaconda3\lib\site-
packages\pip\_vendor\requests\packages\urllib3\connectionpool.py", line
797, in _prepare_proxy
conn.connect()
File "D:\Anaconda3\lib\site-
packages\pip\_vendor\requests\packages\urllib3\connection.py", line
254, in connect
conn = self._new_conn()
File "D:\Anaconda3\lib\site-
packages\pip\_vendor\requests\packages\urllib3\connection.py", line
142, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "D:\Anaconda3\lib\site-
packages\pip\_vendor\requests\packages\urllib3\util\connection.py",
line 66, in create_connection
if host.startswith('['):
AttributeError: 'NoneType' object has no attribute 'startswith'
I'd appreciate if you could see the image:
Did you follow the steps required for Anaconda installation of tensorflow through pip. It seems to be more elaborate that just pip install tensorflow:
https://www.tensorflow.org/versions/r0.12/get_started/os_setup#anaconda_installation
To whom it may concern, there is this duplicate post, where the OP commented a solution to this problem was found:
Resolved duplicate
It would seem, your python path "D:\Anaconda3" might have something to do with errors using pip install. Try to install python on "C:\".
I had the same problem with pip. It turned out to be an incorrectly formatted url for my proxy where I incorrectly used only one forward slash:
http:/myproxy...
After correcting the above to a working url, everything works.
I tried this command
pip install --proxy="username:password#192.168.1.1:3128" packagename
and the error message say:
Traceback (most recent call last):
File "/usr/local/python3.5/lib/python3.5/site-packages/pip-1.5.5-py3.5.egg/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/local/python3.5/lib/python3.5/site-packages/pip-1.5.5-py3.5.egg/pip/commands/install.py", line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/usr/local/python3.5/lib/python3.5/site-packages/pip-1.5.5-py3.5.egg/pip/req.py", line 1177, in prepare_files
url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
File "/usr/local/python3.5/lib/python3.5/site-packages/pip-1.5.5-py3.5.egg/pip/index.py", line 194, in find_requirement
page = self._get_page(main_index_url, req)
File "/usr/local/python3.5/lib/python3.5/site-packages/pip-1.5.5-py3.5.egg/pip/index.py", line 568, in _get_page
session=self.session,
File "/usr/local/python3.5/lib/python3.5/site-packages/pip-1.5.5-py3.5.egg/pip/index.py", line 670, in get_page
resp = session.get(url, headers={"Accept": "text/html"})
File "/usr/local/python3.5/lib/python3.5/site-packages/pip-1.5.5-py3.5.egg/pip/_vendor/requests/sessions.py", line 395, in get
return self.request('GET', url, **kwargs)
File "/usr/local/python3.5/lib/python3.5/site-packages/pip-1.5.5-py3.5.egg/pip/download.py", line 237, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/usr/local/python3.5/lib/python3.5/site-packages/pip-1.5.5-py3.5.egg/pip/_vendor/requests/sessions.py", line 383, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/python3.5/lib/python3.5/site-packages/pip-1.5.5-py3.5.egg/pip/_vendor/requests/sessions.py", line 486, in send
r = adapter.send(request, **kwargs)
File "/usr/local/python3.5/lib/python3.5/site-packages/pip-1.5.5-py3.5.egg/pip/_vendor/requests/adapters.py", line 305, in send
conn = self.get_connection(request.url, proxies)
File "/usr/local/python3.5/lib/python3.5/site-packages/pip-1.5.5-py3.5.egg/pip/_vendor/requests/adapters.py", line 206, in get_connection
except_on_missing_scheme(proxy)
File "/usr/local/python3.5/lib/python3.5/site-packages/pip-1.5.5-py3.5.egg/pip/_vendor/requests/utils.py", line 631, in except_on_missing_scheme
raise MissingSchema('Proxy URLs must have explicit schemes.')
pip._vendor.requests.exceptions.MissingSchema: Proxy URLs must have explicit schemes.
By the way, I remember if the username or password has the interpunction like "." it must be replaced with something but I forget about that. Can anyone remind me of that? Thanks!
I was struggling with this issue too. After many expeiments with pip and easy_install proxy settings I give up and donwloaded whl files from here.
and install them:
pip install SomePackage-1.0-py2.py3-none-any.whl
I am attempting to upgrade my tensorflow via conda but am having some issues. I am following the Anaconda installation procedure here.
I am getting an error when I execute the conda create -n tensorflow command.
Here is the error:
Traceback (most recent call last):
File "/Users/madhavthaker/Downloads/anaconda/lib/python2.7/site-packages/conda/exceptions.py", line 479, in conda_exception_handler
return_value = func(*args, **kwargs)
File "/Users/madhavthaker/Downloads/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 145, in _main
exit_code = args.func(args, p)
File "/Users/madhavthaker/Downloads/anaconda/lib/python2.7/site-packages/conda/cli/main_create.py", line 68, in execute
install(args, parser, 'create')
File "/Users/madhavthaker/Downloads/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 238, in install
prefix=prefix)
File "/Users/madhavthaker/Downloads/anaconda/lib/python2.7/site-packages/conda/api.py", line 24, in get_index
index = fetch_index(channel_urls, use_cache=use_cache, unknown=unknown)
File "/Users/madhavthaker/Downloads/anaconda/lib/python2.7/site-packages/conda/fetch.py", line 300, in fetch_index
repodatas = [(u, f.result()) for u, f in zip(urls, futures)]
File "/Users/madhavthaker/Downloads/anaconda/lib/python2.7/site-packages/concurrent/futures/_base.py", line 403, in result
return self.__get_result()
File "/Users/madhavthaker/Downloads/anaconda/lib/python2.7/site-packages/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
File "/Users/madhavthaker/Downloads/anaconda/lib/python2.7/site-packages/conda/fetch.py", line 75, in func
res = f(*args, **kwargs)
File "/Users/madhavthaker/Downloads/anaconda/lib/python2.7/site-packages/conda/fetch.py", line 117, in fetch_repodata
timeout=(6.1, 60))
File "/Users/madhavthaker/Downloads/anaconda/lib/python2.7/site-packages/requests/sessions.py", line 480, in get
return self.request('GET', url, **kwargs)
File "/Users/madhavthaker/Downloads/anaconda/lib/python2.7/site-packages/requests/sessions.py", line 468, in request
resp = self.send(prep, **send_kwargs)
File "/Users/madhavthaker/Downloads/anaconda/lib/python2.7/site-packages/requests/sessions.py", line 576, in send
r = adapter.send(request, **kwargs)
File "/Users/madhavthaker/Downloads/anaconda/lib/python2.7/site-packages/requests/adapters.py", line 376, in send
timeout=timeout
File "/Users/madhavthaker/Downloads/anaconda/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 559, in urlopen
body=body, headers=headers)
File "/Users/madhavthaker/Downloads/anaconda/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 345, in _make_request
self._validate_conn(conn)
File "/Users/madhavthaker/Downloads/anaconda/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 784, in _validate_conn
conn.connect()
File "/Users/madhavthaker/Downloads/anaconda/lib/python2.7/site-packages/requests/packages/urllib3/connection.py", line 252, in connect
ssl_version=resolved_ssl_version)
File "/Users/madhavthaker/Downloads/anaconda/lib/python2.7/site-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 296, in ssl_wrap_socket
cnx.set_tlsext_host_name(server_hostname)
File "/Users/madhavthaker/Downloads/anaconda/lib/python2.7/site-packages/OpenSSL/SSL.py", line 1232, in set_tlsext_host_name
raise TypeError("name must be a byte string")
TypeError: name must be a byte string
I'm done some googling and haven't been able to find a useful response. Any help would be much appreciated.
Your conda is using python 2.7, you may have to upgrade it to python 3.x
I say this because in the anaconda installation guide you linked, it shows a call to print with parentheses, which is python 3 syntax
I am playing around with GMAIL API to create an app to send auto emails from my server. Running my application as a simple user has the following results:
pankgeorg#snf-25181:~/tomotech/gmailer$ python mailer.py
Traceback (most recent call last):
File "mailer.py", line 36, in <module>
gmail_service = build('gmail', 'v1', http=http)
File "/usr/local/lib/python2.7/dist-packages/oauth2client-1.4.5-py2.7.egg/oauth2client/util.py", line 135, in positional_wrapper
File "/usr/local/lib/python2.7/dist-packages/google_api_python_client-1.3.1-py2.7.egg/googleapiclient/discovery.py", line 198, in build
File "/usr/local/lib/python2.7/dist-packages/oauth2client-1.4.5-py2.7.egg/oauth2client/util.py", line 135, in positional_wrapper
File "/usr/local/lib/python2.7/dist-packages/oauth2client-1.4.5-py2.7.egg/oauth2client/client.py", line 547, in new_request
File "/usr/local/lib/python2.7/dist-packages/httplib2-0.9-py2.7.egg/httplib2/__init__.py", line 1593, in request
(response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
File "/usr/local/lib/python2.7/dist-packages/httplib2-0.9-py2.7.egg/httplib2/__init__.py", line 1335, in _request
(response, content) = self._conn_request(conn, request_uri, method, body, headers)
File "/usr/local/lib/python2.7/dist-packages/httplib2-0.9-py2.7.egg/httplib2/__init__.py", line 1257, in _conn_request
conn.connect()
File "/usr/local/lib/python2.7/dist-packages/httplib2-0.9-py2.7.egg/httplib2/__init__.py", line 1021, in connect
self.disable_ssl_certificate_validation, self.ca_certs)
File "/usr/local/lib/python2.7/dist-packages/httplib2-0.9-py2.7.egg/httplib2/__init__.py", line 80, in _ssl_wrap_socket
cert_reqs=cert_reqs, ca_certs=ca_certs)
File "/usr/lib/python2.7/ssl.py", line 886, in wrap_socket
ciphers=ciphers)
File "/usr/lib/python2.7/ssl.py", line 496, in __init__
self._context.load_verify_locations(ca_certs)
IOError: [Errno 13] Permission denied
On the other hand, running with sudo works perfectly
pankgeorg#snf-25181:~/tomotech/gmailer$ sudo python mailer.py
Message Id: 14ad0aea05e*****
To be completely honest, in order to authenicate using --noauth_local_webserver, I run the command with sudo, authenticated and chown the gmail.storage to myself again.
Also, I installed using easy_install because pip install was giving me the following error:
pankgeorg#snf-25181:~/tomotech/gmailer$ sudo pip install --upgrade google_api_python_client
Cleaning up...
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/dist-packages/pip/commands/install.py", line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/usr/local/lib/python2.7/dist-packages/pip/req.py", line 1096, in prepare_files
req_to_install, self.upgrade)
File "/usr/local/lib/python2.7/dist-packages/pip/index.py", line 194, in find_requirement
page = self._get_page(main_index_url, req)
File "/usr/local/lib/python2.7/dist-packages/pip/index.py", line 568, in _get_page
session=self.session,
File "/usr/local/lib/python2.7/dist-packages/pip/index.py", line 670, in get_page
resp = session.get(url, headers={"Accept": "text/html"})
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/sessions.py", line 395, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pip/download.py", line 237, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/sessions.py", line 383, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/sessions.py", line 506, in send
history = [resp for resp in gen] if allow_redirects else []
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/sessions.py", line 168, in resolve_redirects
allow_redirects=False,
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/sessions.py", line 486, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/adapters.py", line 330, in send
timeout=timeout
File "/usr/local/lib/python2.7/dist- packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 480, in urlopen
body=body, headers=headers)
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 285, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/lib/python2.7/httplib.py", line 1001, in request
self._send_request(method, url, body, headers)
File "/usr/lib/python2.7/httplib.py", line 1035, in _send_request
self.endheaders(body)
File "/usr/lib/python2.7/httplib.py", line 997, in endheaders
self._send_output(message_body)
File "/usr/lib/python2.7/httplib.py", line 850, in _send_output
self.send(msg)
File "/usr/lib/python2.7/httplib.py", line 826, in send
self.sock.sendall(data)
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.py", line 323, in sendall
return self.connection.sendall(data)
File "/usr/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 969, in sendall
raise TypeError("buf must be a byte string")
TypeError: buf must be a byte string
Storing debug log for failure in /root/.pip/pip.logrom oath2client import tool
It is my understanding that the root of the problem is the same in both cases.
I also have to note that my laptop (on which I can authenticate normally, on webbrowser, instead of --noauth_local_webserver) it works just fine, even though the installation is done the same way (the problem with pip appears there too).
Thanks in advance and sorry for the long post!
Tutorials I used:
parse arg
code for sending mails
application body is pretty much the quickstart for gmail api.
The httplib2 installer sets incorrect permissions for its httplib2/cacerts.txt file. One solution is to simply make its files readable by anyone by running
chmod o+r -R /usr/local/lib/python2.7/dist-packages/httplib2-0.9-py2.7.egg
However, it may be better to uninstall the version installed by pip, and use your operating system's package manager instead, which probably has the correct permissions for all files. On Debian, this could be accomplished with
pip uninstall httplib2
apt-get install python-httplib2
I have neo4j-2.1.3 installed and server running on my Linux system . I created model "publisher" in my app . And then in manage.py shell , whenever I save a node with
from BooksGraph.models import Publisher
p=Publisher.objects.create(name='Sunny',address='b-1/196')
a long error pops up with:
Traceback (most recent call last):
File "", line 1, in File
"/usr/local/lib/python2.7/dist-packages/neo4django/db/models/manager.py",
line 42, in create return self.get_query_set().create(**kwargs) File
"/usr/local/lib/python2.7/dist-packages/neo4django/db/models/query.py",
line 1052, in create return super(NodeQuerySet, self).create(**kwargs)
File
"/usr/local/lib/python2.7/dist-packages/django/db/models/query.py",
line 377, in create obj.save(force_insert=True, using=self.db) File
"/usr/local/lib/python2.7/dist-packages/neo4django/db/models/base.py",
line 325, in save return super(NodeModel, self).save(using=using,
**kwargs) File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py",
line 463, in save self.save_base(using=using,
force_insert=force_insert, force_update=force_update) File
"/usr/local/lib/python2.7/dist-packages/neo4django/db/models/base.py",
line 341, in save_base self._save_neo4j_node(using) File "",
line 2, in _save_neo4j_node File
"/usr/local/lib/python2.7/dist-packages/neo4django/db/models/base.py",
line 111, in trans_method
len(connections[args[0].using]._transactions) < 1: File
"/usr/local/lib/python2.7/dist-packages/neo4django/utils.py", line
313, in getitem **db['OPTIONS']) File
"/usr/local/lib/python2.7/dist-packages/neo4django/neo4jclient.py",
line 29, in init super(EnhancedGraphDatabase,
self).init(*args, **kwargs) File
"/usr/local/lib/python2.7/dist-packages/neo4jrestclient/client.py",
line 74, in init response = Request(**self._auth).get(self.url)
File
"/usr/local/lib/python2.7/dist-packages/neo4jrestclient/request.py",
line 63, in get return self._request('GET', url, headers=headers) File
"/usr/local/lib/python2.7/dist-packages/neo4django/db/init.py",
line 60, in _request headers) File
"/usr/local/lib/python2.7/dist-packages/neo4jrestclient/request.py",
line 198, in _request auth=auth, verify=verify) File
"/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line
468, in get return self.request('GET', url, **kwargs) File
"/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line
456, in request resp = self.send(prep, **send_kwargs) File
"/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line
559, in send r = adapter.send(request, **kwargs) File
"/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line
378, in send raise ProxyError(e) ProxyError: ('Cannot connect to
proxy.', error(113, 'No route to host'))
This sounds like a network setup problem. Can you check what URL the library is trying to connect to and that that one really goes to your local Neo4j Server?