I'm trying to post some data to a url, but I'm running int a python error that doesn't make any sense to me.
Here is the error:
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/logging/__init__.py", line 765, in emit
UnicodeDecodeError: 'ascii' codec can't decode byte 0x83 in position 1086: ordinal not in range(128)
ERROR 2011-12-09 16:58:16,664 dev_appserver.py:4096] Exception encountered handling request
Traceback (most recent call last):
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 4039, in _HandleRequest
self._Dispatch(dispatcher, self.rfile, outfile, env_dict)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 3945, in _Dispatch
base_env_dict=env_dict)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 605, in Dispatch
base_env_dict=base_env_dict)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 3015, in Dispatch
self._module_dict)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 2925, in ExecuteCGI
reset_modules = exec_script(handler_path, cgi_path, hook)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 2787, in ExecuteOrImportScript
script_module.main()
File "/Users/bryce/Documents/Aptana Studio 3 Workspace/DennysBE/djangoappengine/main/main.py", line 87, in real_main
run_wsgi_app(application)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/webapp/util.py", line 98, in run_wsgi_app
run_bare_wsgi_app(add_wsgi_middleware(application))
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/webapp/util.py", line 116, in run_bare_wsgi_app
result = application(env, _start_response)
File "/Users/bryce/Documents/Aptana Studio 3 Workspace/DennysBE/django/core/handlers/wsgi.py", line 273, in __call__
response = self.get_response(request)
File "/Users/bryce/Documents/Aptana Studio 3 Workspace/DennysBE/django/core/handlers/base.py", line 169, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File "/Users/bryce/Documents/Aptana Studio 3 Workspace/DennysBE/django/core/handlers/base.py", line 203, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)
File "/Users/bryce/Documents/Aptana Studio 3 Workspace/DennysBE/django/views/debug.py", line 59, in technical_500_response
html = reporter.get_traceback_html()
File "/Users/bryce/Documents/Aptana Studio 3 Workspace/DennysBE/django/views/debug.py", line 114, in get_traceback_html
frames = self.get_traceback_frames()
File "/Users/bryce/Documents/Aptana Studio 3 Workspace/DennysBE/django/views/debug.py", line 242, in get_traceback_frames
pre_context_lineno, pre_context, context_line, post_context = self._get_lines_from_file(filename, lineno, 7, loader, module_name)
File "/Users/bryce/Documents/Aptana Studio 3 Workspace/DennysBE/django/views/debug.py", line 223, in _get_lines_from_file
context_line = source[lineno].strip('\n')
IndexError: list index out of range
This causes the above error:
request = urllib2.Request("http://google.com/foo/", headers={"Accept" : "text/html"})
contents = urllib2.urlopen(request).read()
This does NOT cause the above error. The only difference is the url:
request = urllib2.Request("http://google.com/", headers={"Accept" : "text/html"})
contents = urllib2.urlopen(request).read()
So the problem appears to be anything anything after the domain name. Any ideas why?
I was able to get my problem to go away by just using urllib and not urllib2. I still don't know what caused the problem, but this workout was fine.
url = 'http://google.com/'
f = urllib.urlopen(url, params)
Related
I only open a logging file:
logging.basicConfig(level=logging.DEBUG,
filename='app.log',
filemode='w', encoding='utf-8')
and a html file (Flask):
site = Template(render_template('base.html', list_of_active_tasks=active_tasks,
list_of_completed_tasks=completed_tasks, checker=checker,
type_of_list=type_of_list))
Every single file have utf-8 encoding, but that is what i get when launching a testing file:
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.3.2\plugins\python-ce\helpers\pycharm\_jb_pytest_runner.py", line 51, in <module>
sys.exit(pytest.main(args, plugins_to_load + [Plugin]))
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\_pytest\config\__init__.py", line 146, in main
config = _prepareconfig(args, plugins)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\_pytest\config\__init__.py", line 325, in _prepareconfig
config = pluginmanager.hook.pytest_cmdline_parse(
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\pluggy\_hooks.py", line 265, in __call__
return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\pluggy\_manager.py", line 80, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\pluggy\_callers.py", line 55, in _multicall
gen.send(outcome)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\_pytest\helpconfig.py", line 102, in pytest_cmdline_parse
config: Config = outcome.get_result()
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\pluggy\_result.py", line 60, in get_result
raise ex[1].with_traceback(ex[2])
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\pluggy\_callers.py", line 39, in _multicall
res = hook_impl.function(*args)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\_pytest\config\__init__.py", line 1013, in pytest_cmdline_parse
self.parse(args)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\_pytest\config\__init__.py", line 1301, in parse
self._preparse(args, addopts=addopts)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\_pytest\config\__init__.py", line 1169, in _preparse
self._initini(args)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\_pytest\config\__init__.py", line 1088, in _initini
rootpath, inipath, inicfg = determine_setup(
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\_pytest\config\findpaths.py", line 186, in determine_setup
rootdir, inipath, inicfg = locate_config([ancestor])
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\_pytest\config\findpaths.py", line 108, in locate_config
ini_config = load_config_dict_from_file(p)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\_pytest\config\findpaths.py", line 56, in load_config_dict_from_file
iniconfig = _parse_ini_config(filepath)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\_pytest\config\findpaths.py", line 30, in _parse_ini_config
return iniconfig.IniConfig(str(path))
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\iniconfig\__init__.py", line 54, in __init__
tokens = self._parse(iter(f))
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\iniconfig\__init__.py", line 82, in _parse
for lineno, line in enumerate(line_iter):
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\encodings\cp1251.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 234: character maps to <undefined>
Process finished with exit code 1
Empty suite
Empty suite
Moreover, my app is working without any issues, but test does not work. How can i fix it?
I have a backup script that has been working fine. I recently updated my OS (to Ubuntu 19.10) and tried to install all of the dependencies but I'm getting an error.
My script is something like:
export PASSPHRASE="passphrase"
PATH=$PATH:/home/jeremy/.boto
export HOME='/home/jeremy/'
DATE=`date +%Y-%m-%d:%H:%M:%S`
echo "Running backup at $DATE" >> /home/jeremy/.backup/log
duplicity --full-if-older-than 1M \
--archive-dir /home/jeremy/.cache/duplicity/ \
/home/jeremy \
gs://x1_carbon_backup >> /home/jeremy/.backup/log
I created the .boto file with gsutil and I can use gsutil successfully, so authentication appears to be working.
The traceback looks like an encoding/decoding problem but I can't tell if it's a problem with how I'm doing things or a bug in boto or duplicity
Traceback (innermost last):
File "/usr/bin/duplicity", line 107, in <module>
with_tempdir(main)
File "/usr/bin/duplicity", line 93, in with_tempdir
fn()
File "/usr/lib/python3/dist-packages/duplicity/dup_main.py", line 1522, in main
action = commandline.ProcessCommandLine(sys.argv[1:])
File "/usr/lib/python3/dist-packages/duplicity/commandline.py", line 1200, in ProcessCommandLine
globals.backend = backend.get_backend(args[0])
File "/usr/lib/python3/dist-packages/duplicity/backend.py", line 225, in get_backend
obj = get_backend_object(url_string)
File "/usr/lib/python3/dist-packages/duplicity/backend.py", line 211, in get_backend_object
return factory(pu)
File "/usr/lib/python3/dist-packages/duplicity/backends/_boto_single.py", line 173, in __init__
self.resetConnection()
File "/usr/lib/python3/dist-packages/duplicity/backends/_boto_single.py", line 199, in resetConnection
location=self.my_location)
File "/home/jeremy/.local/lib/python3.7/site-packages/boto/gs/connection.py", line 95, in create_bucket
data=get_utf8_value(data))
File "/home/jeremy/.local/lib/python3.7/site-packages/boto/s3/connection.py", line 659, in make_request
auth_path = self.calling_format.build_auth_path(bucket, key)
File "/home/jeremy/.local/lib/python3.7/site-packages/boto/s3/connection.py", line 94, in build_auth_path
path = '/' + bucket
TypeError: can only concatenate str (not "bytes") to str
I tried to decode the bucket variable as suggested here.
Now I am getting an SSLCertVerificationError, below:
Traceback (most recent call last):
File "/usr/bin/duplicity", line 163, in <module>
if u"Forced assertion for testing" in util.uexc(e):
File "/usr/lib/python3/dist-packages/duplicity/util.py", line 120, in uexc
return fsdecode(m)
File "/usr/lib/python3.7/os.py", line 822, in fsdecode
filename = fspath(filename) # Does type-checking of `filename`.
TypeError: expected str, bytes or os.PathLike object, not int
Backup complete. Checking for old backups to remove
Traceback (most recent call last):
File "/usr/bin/duplicity", line 107, in <module>
with_tempdir(main)
File "/usr/bin/duplicity", line 93, in with_tempdir
fn()
File "/usr/lib/python3/dist-packages/duplicity/dup_main.py", line 1522, in main
action = commandline.ProcessCommandLine(sys.argv[1:])
File "/usr/lib/python3/dist-packages/duplicity/commandline.py", line 1200, in ProcessCommandLine
globals.backend = backend.get_backend(args[0])
File "/usr/lib/python3/dist-packages/duplicity/backend.py", line 225, in get_backend
obj = get_backend_object(url_string)
File "/usr/lib/python3/dist-packages/duplicity/backend.py", line 211, in get_backend_object
return factory(pu)
File "/usr/lib/python3/dist-packages/duplicity/backends/_boto_single.py", line 173, in __init__
self.resetConnection()
File "/usr/lib/python3/dist-packages/duplicity/backends/_boto_single.py", line 199, in resetConnection
location=self.my_location)
File "/home/jeremy/.local/lib/python3.7/site-packages/boto/gs/connection.py", line 95, in create_bucket
data=get_utf8_value(data))
File "/home/jeremy/.local/lib/python3.7/site-packages/boto/s3/connection.py", line 671, in make_request
retry_handler=retry_handler
File "/home/jeremy/.local/lib/python3.7/site-packages/boto/connection.py", line 1071, in make_request
retry_handler=retry_handler)
File "/home/jeremy/.local/lib/python3.7/site-packages/boto/connection.py", line 1030, in _mexe
raise ex
File "/home/jeremy/.local/lib/python3.7/site-packages/boto/connection.py", line 943, in _mexe
request.body, request.headers)
File "/usr/lib/python3.7/http/client.py", line 1252, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.7/http/client.py", line 1298, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib/python3.7/http/client.py", line 1247, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib/python3.7/http/client.py", line 1026, in _send_output
self.send(msg)
File "/usr/lib/python3.7/http/client.py", line 966, in send
self.connect()
File "/home/jeremy/.local/lib/python3.7/site-packages/boto/https_connection.py", line 131, in connect
ca_certs=self.ca_certs)
File "/usr/lib/python3.7/ssl.py", line 1238, in wrap_socket
suppress_ragged_eofs=suppress_ragged_eofs
File "/usr/lib/python3.7/ssl.py", line 423, in wrap_socket
session=session
File "/usr/lib/python3.7/ssl.py", line 870, in _create
self.do_handshake()
File "/usr/lib/python3.7/ssl.py", line 1139, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1076)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/duplicity", line 163, in <module>
if u"Forced assertion for testing" in util.uexc(e):
File "/usr/lib/python3/dist-packages/duplicity/util.py", line 120, in uexc
return fsdecode(m)
File "/usr/lib/python3.7/os.py", line 822, in fsdecode
filename = fspath(filename) # Does type-checking of `filename`.
TypeError: expected str, bytes or os.PathLike object, not int
I am trying to install Django 1.6.11 but getting this error message:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xcf in position 7: ordinal not in range(128)
Full traceback:
(lwc_env) C:\Users\lenovo\PycharmProjects\lwc_env>pip install django==1.6.11
Collecting django==1.6.11
Exception:
Traceback (most recent call last):
File "C:\Users\lenovo\PycharmProjects\lwc_env\lib\site-packages\pip\basecommand.py", line 223, in main
status = self.run(options, args)
File "C:\Users\lenovo\PycharmProjects\lwc_env\lib\site-packages\pip\commands\install.py", line 293, in run
wb.build(autobuilding=True)
File "C:\Users\lenovo\PycharmProjects\lwc_env\lib\site-packages\pip\wheel.py", line 705, in build
self.requirement_set.prepare_files(self.finder)
File "C:\Users\lenovo\PycharmProjects\lwc_env\lib\site-packages\pip\req\req_set.py", line 334, in prepare_files
functools.partial(self._prepare_file, finder))
File "C:\Users\lenovo\PycharmProjects\lwc_env\lib\site-packages\pip\req\req_set.py", line 321, in _walk_req_to_install
more_reqs = handler(req_to_install)
File "C:\Users\lenovo\PycharmProjects\lwc_env\lib\site-packages\pip\req\req_set.py", line 461, in _prepare_file
req_to_install.populate_link(finder, self.upgrade)
File "C:\Users\lenovo\PycharmProjects\lwc_env\lib\site-packages\pip\req\req_install.py", line 249, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "C:\Users\lenovo\PycharmProjects\lwc_env\lib\site-packages\pip\index.py", line 486, in find_requirement
all_versions = self._find_all_versions(req.name)
File "C:\Users\lenovo\PycharmProjects\lwc_env\lib\site-packages\pip\index.py", line 404, in _find_all_versions
index_locations = self._get_index_urls_locations(project_name)
File "C:\Users\lenovo\PycharmProjects\lwc_env\lib\site-packages\pip\index.py", line 378, in _get_index_urls_locations
page = self._get_page(main_index_url)
File "C:\Users\lenovo\PycharmProjects\lwc_env\lib\site-packages\pip\index.py", line 818, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "C:\Users\lenovo\PycharmProjects\lwc_env\lib\site-packages\pip\index.py", line 928, in get_page
"Cache-Control": "max-age=600",
File "C:\Users\lenovo\PycharmProjects\lwc_env\lib\site-packages\pip\_vendor\requests\sessions.py", line 477, in get
return self.request('GET', url, **kwargs)
File "C:\Users\lenovo\PycharmProjects\lwc_env\lib\site-packages\pip\download.py", line 373, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "C:\Users\lenovo\PycharmProjects\lwc_env\lib\site-packages\pip\_vendor\requests\sessions.py", line 465, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\lenovo\PycharmProjects\lwc_env\lib\site-packages\pip\_vendor\requests\sessions.py", line 605, in send
r.content
File "C:\Users\lenovo\PycharmProjects\lwc_env\lib\site-packages\pip\_vendor\requests\models.py", line 750, in content
self._content = bytes().join(self.iter_content(CONTENT_CHUNK_SIZE)) or bytes()
File "C:\Users\lenovo\PycharmProjects\lwc_env\lib\site-packages\pip\_vendor\requests\models.py", line 673, in generate
for chunk in self.raw.stream(chunk_size, decode_content=True):
File "C:\Users\lenovo\PycharmProjects\lwc_env\lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 307, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "C:\Users\lenovo\PycharmProjects\lwc_env\lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 243, in read
data = self._fp.read(amt)
File "C:\Users\lenovo\PycharmProjects\lwc_env\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 54, in read
self.__callback(self.__buf.getvalue())
File "C:\Users\lenovo\PycharmProjects\lwc_env\lib\site-packages\pip\_vendor\cachecontrol\controller.py", line 244, in cache_response
self.serializer.dumps(request, response, body=body),
File "C:\Users\lenovo\PycharmProjects\lwc_env\lib\site-packages\pip\download.py", line 276, in set
return super(SafeFileCache, self).set(*args, **kwargs)
File "C:\Users\lenovo\PycharmProjects\lwc_env\lib\site-packages\pip\_vendor\cachecontrol\caches\file_cache.py", line 99, in set
with self.lock_class(name) as lock:
File "C:\Users\lenovo\PycharmProjects\lwc_env\lib\site-packages\pip\_vendor\lockfile\mkdirlockfile.py", line 18, in __init__
LockBase.__init__(self, path, threaded, timeout)
File "C:\Users\lenovo\PycharmProjects\lwc_env\lib\site-packages\pip\_vendor\lockfile\__init__.py", line 189, in __init__
hash(self.path)))
File "C:\Users\lenovo\PycharmProjects\lwc_env\lib\ntpath.py", line 85, in join
result_path = result_path + p_path
UnicodeDecodeError: 'ascii' codec can't decode byte 0xcf in position 7: ordinal not in range(128)
I am using PyCharm on Windows 7 if this matters. Is there a problem with my computer or am I just doing something wrong?
Thank you for help!
Hi Im trying to install pip on my pc - windows 8 in hebrew.
I installed python 2.7. I added python to my path.
I ran some random printing in python file and its work. so python is ok.
when i try to install get-pip.py I get this error:
C:\Users\yogi>python get-pip.py
Exception:
Traceback (most recent call last):
File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\basecommand.py",
line 232, in main
status = self.run(options, args)
File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\commands\install.
py", line 339, in run
requirement_set.prepare_files(finder)
File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\req\req_set.py",
line 235, in prepare_files
req_to_install, self.upgrade)
File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\index.py", line 3
05, in find_requirement
page = self._get_page(main_index_url, req)
File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\index.py", line 7
83, in _get_page
return HTMLPage.get_page(link, req, session=self.session)
File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\index.py", line 8
72, in get_page
"Cache-Control": "max-age=600",
File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\_vendor\requests\
sessions.py", line 473, in get
return self.request('GET', url, **kwargs)
File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\download.py", lin
e 365, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\_vendor\requests\
sessions.py", line 461, in request
resp = self.send(prep, **send_kwargs)
File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\_vendor\requests\
sessions.py", line 610, in send
r.content
File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\_vendor\requests\
models.py", line 728, in content
self._content = bytes().join(self.iter_content(CONTENT_CHUNK_SIZE)) or bytes
()
File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\_vendor\requests\
models.py", line 653, in generate
for chunk in self.raw.stream(chunk_size, decode_content=True):
File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\_vendor\requests\
packages\urllib3\response.py", line 256, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\_vendor\requests\
packages\urllib3\response.py", line 186, in read
data = self._fp.read(amt)
File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\_vendor\cachecont
rol\filewrapper.py", line 54, in read
self.__callback(self.__buf.getvalue())
File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\_vendor\cachecont
rol\controller.py", line 213, in cache_response
self.serializer.dumps(request, response, body=body),
File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\download.py", lin
e 268, in set
return super(SafeFileCache, self).set(*args, **kwargs)
File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\_vendor\cachecont
rol\caches\file_cache.py", line 83, in set
with FileLock(name) as lock:
File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\_vendor\lockfile\
mkdirlockfile.py", line 18, in __init__
LockBase.__init__(self, path, threaded, timeout)
File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\_vendor\lockfile\
__init__.py", line 189, in __init__
hash(self.path)))
File "C:\Python27\lib\ntpath.py", line 84, in join
result_path = result_path + p_path
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 0: ordinal
not in range(128)
any help would appreciated
Thought you may wanna try these since you are installing it in Hebrew.
1.) Open path "C:\Python27\Lib\" and search for python file "mimetypes.py".
2.) Open and Edit that file. Search for line "default_encoding = sys.getdefaultencoding()"
3.) And add these lines before the searched line in (step 2):
if sys.getdefaultencoding() != 'gbk':
reload(sys)
sys.setdefaultencoding('gbk')
The UnicodeDecode Error might be because you are using wrong version of get-pip.py.
All the strings in Python3 are unicode by default, but in Python2 it is not so.
If you are trying to use get-pip of Python3 with Python2, it might likely be the cause of your error.Try checking for/ obtaining the correct version! :)
I am trying to read a matlab file with SCIPY.IO library. And i am recieving the following error
Drives = sio.loadmat('Data/Drives.mat')
Traceback (most recent call last):
File "C:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Mic
rosoft\Python Tools for Visual Studio\2.0\visualstudio_py_util.py", line 76, in
exec_file
exec(code_obj, global_variables)
File "C:\Users\nasir\documents\visual studio 2013\Projects\EnergyInformatics\E
nergyInformatics\main.py", line 82, in <module>
main()
File "C:\Users\nasir\documents\visual studio 2013\Projects\EnergyInformatics\E
nergyInformatics\main.py", line 44, in main
simulation = SetupSimulation(server_sock=None,NUMBER_OF_PEVS=item[0],Grid_Fa
ctor=item[1],SOLAR_FACTOR=5,CHARGE_AT="HOME",ONE_PARKING_PERIOD=True,PARAM_FILEN
AME=None)
File "C:\Users\nasir\documents\visual studio 2013\Projects\EnergyInformatics\E
nergyInformatics\SetupSimulation.py", line 33, in __init__
self.GenerateVehicles()
File "C:\Users\nasir\documents\visual studio 2013\Projects\EnergyInformatics\E
nergyInformatics\SetupSimulation.py", line 99, in GenerateVehicles
drivingProfiles, consumptionProfiles = self.Create_Driving_Profiles(self.NUM
BER_OF_PEVS, TIMESTEPS_DRIVING, STEPSIZE, DAY_TYPE, SEASON)
File "C:\Users\nasir\documents\visual studio 2013\Projects\EnergyInformatics\E
nergyInformatics\SetupSimulation.py", line 130, in Create_Driving_Profiles
muenchenDrives = sio.loadmat('Data/muenchenDrives.mat')
File "C:\Python32\lib\site-packages\scipy\io\matlab\mio.py", line 175, in load
mat
matfile_dict = MR.get_variables(variable_names)
File "C:\Python32\lib\site-packages\scipy\io\matlab\mio5.py", line 292, in get
_variables
res = self.read_var_array(hdr, process)
File "C:\Python32\lib\site-packages\scipy\io\matlab\mio5.py", line 255, in rea
d_var_array
return self._matrix_reader.array_from_header(header, process)
File "mio5_utils.pyx", line 624, in scipy.io.matlab.mio5_utils.VarReader5.arra
y_from_header (scipy\io\matlab\mio5_utils.c:5401)
File "mio5_utils.pyx", line 671, in scipy.io.matlab.mio5_utils.VarReader5.arra
y_from_header (scipy\io\matlab\mio5_utils.c:5062)
File "mio5_utils.pyx", line 900, in scipy.io.matlab.mio5_utils.VarReader5.read
_struct (scipy\io\matlab\mio5_utils.c:7576)
File "mio5_utils.pyx", line 622, in scipy.io.matlab.mio5_utils.VarReader5.read
_mi_matrix (scipy\io\matlab\mio5_utils.c:4662)
File "mio5_utils.pyx", line 669, in scipy.io.matlab.mio5_utils.VarReader5.arra
y_from_header (scipy\io\matlab\mio5_utils.c:5040)
File "mio5_utils.pyx", line 822, in scipy.io.matlab.mio5_utils.VarReader5.read
_cells (scipy\io\matlab\mio5_utils.c:6748)
File "mio5_utils.pyx", line 622, in scipy.io.matlab.mio5_utils.VarReader5.read
_mi_matrix (scipy\io\matlab\mio5_utils.c:4662)
File "mio5_utils.pyx", line 665, in scipy.io.matlab.mio5_utils.VarReader5.arra
y_from_header (scipy\io\matlab\mio5_utils.c:4979)
File "mio5_utils.pyx", line 802, in scipy.io.matlab.mio5_utils.VarReader5.read
_char (scipy\io\matlab\mio5_utils.c:6450)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfc in position 44: invalid
start byte
I have tried the codecs library too but it did not work. any help or suggestion will be highly appreciated