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?
Related
Few days ago, Anaconda Navigator used to work fine but now it won't open; I've even reinstalled the navigator but still getting the same issue.
Here is the error message
Navigator Error:
An unexpected error occurred on Navigator start-up
Main Error
unacceptable character #x0000: special characters are not allowed
in "C:\Users\home\.continuum\anaconda-client\config.yaml", position 0
Traceback
Traceback (most recent call last):
File "C:\Users\home\anaconda3\lib\site-packages\anaconda_navigator\exceptions.py", line 72, in exception_handler
return_value = func(*args, **kwargs)
File "C:\Users\home\anaconda3\lib\site-packages\anaconda_navigator\app\start.py", line 146, in start_app
window = run_app(splash)
File "C:\Users\home\anaconda3\lib\site-packages\anaconda_navigator\app\start.py", line 65, in run_app
window = MainWindow(splash=splash)
File "C:\Users\home\anaconda3\lib\site-packages\anaconda_navigator\widgets\main_window.py", line 165, in __init__
self.api = AnacondaAPI()
File "C:\Users\home\anaconda3\lib\site-packages\anaconda_navigator\api\anaconda_api.py", line 1518, in AnacondaAPI
ANACONDA_API = _AnacondaAPI()
File "C:\Users\home\anaconda3\lib\site-packages\anaconda_navigator\api\anaconda_api.py", line 83, in __init__
self._client_api = ClientAPI(config=self.config)
File "C:\Users\home\anaconda3\lib\site-packages\anaconda_navigator\api\client_api.py", line 659, in ClientAPI
CLIENT_API = _ClientAPI(config=config)
File "C:\Users\home\anaconda3\lib\site-packages\anaconda_navigator\api\client_api.py", line 95, in __init__
self.reload_client()
File "C:\Users\home\anaconda3\lib\site-packages\anaconda_navigator\api\client_api.py", line 322, in reload_client
url = binstar_client.utils.get_config()['url']
File "C:\Users\home\anaconda3\lib\site-packages\binstar_client\utils\config.py", line 249, in get_config
file_configs = load_file_configs(SEARCH_PATH)
File "C:\Users\home\anaconda3\lib\site-packages\binstar_client\utils\config.py", line 241, in load_file_configs
raw_data = collections.OrderedDict(kv for kv in itertools.chain.from_iterable(load_paths))
File "C:\Users\home\anaconda3\lib\site-packages\binstar_client\utils\config.py", line 241, in
raw_data = collections.OrderedDict(kv for kv in itertools.chain.from_iterable(load_paths))
File "C:\Users\home\anaconda3\lib\site-packages\binstar_client\utils\config.py", line 221, in _dir_yaml_loader
yield filepath, load_config(filepath)
File "C:\Users\home\anaconda3\lib\site-packages\binstar_client\utils\config.py", line 205, in load_config
data = yaml_load(fd)
File "C:\Users\home\anaconda3\lib\site-packages\binstar_client\utils\yaml.py", line 12, in yaml_load
return safe_load(stream)
File "C:\Users\home\anaconda3\lib\site-packages\yaml\__init__.py", line 162, in safe_load
return load(stream, SafeLoader)
File "C:\Users\home\anaconda3\lib\site-packages\yaml\__init__.py", line 112, in load
loader = Loader(stream)
File "C:\Users\home\anaconda3\lib\site-packages\yaml\loader.py", line 34, in __init__
Reader.__init__(self, stream)
File "C:\Users\home\anaconda3\lib\site-packages\yaml\reader.py", line 85, in __init__
self.determine_encoding()
File "C:\Users\home\anaconda3\lib\site-packages\yaml\reader.py", line 135, in determine_encoding
self.update(1)
File "C:\Users\home\anaconda3\lib\site-packages\yaml\reader.py", line 169, in update
self.check_printable(data)
File "C:\Users\home\anaconda3\lib\site-packages\yaml\reader.py", line 143, in check_printable
raise ReaderError(self.name, position, ord(character),
yaml.reader.ReaderError: unacceptable character #x0000: special characters are not allowed
in "C:\Users\home\.continuum\anaconda-client\config.yaml", position 0
According to github the problem lies with "config.yaml" file in C:\Users\axith.continuum\anaconda-client\config.yaml , rename it to config.old or delete it
Trying to setup pytest-testrail plugin. When I start test run using --testrail --tr-config=path/to/config.cfg param, it returns error ValueError: option names {'--testrail'} already added
im using appium+pytest+allure. It works well for me, but now im trying to add testrail integration. I setup pytest-testrail plugin correct(test run successfully created in testrail with list of my auto test), but when I add from pytest_testrail.conftest import * to my own conftest file, in return error .
I try to reinstall pytest and pytest-testrail plugin multiple times, but it doesn't help
conftest file:
import pytest
from appium import webdriver
from pytest_testrail.conftest import *
import sys
import os.path
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir, os.pardir))
PATH = lambda p: os.path.abspath(
os.path.join(os.path.dirname(__file__), p)
)
#pytest.fixture
def driver_setup(request):
desired_caps = {
//desired caps for appium driver
}
url = 'http://localhost:4723/wd/hub'
request.instance.driver = webdriver.Remote(url, desired_caps)
def teardown():
request.instance.driver.quit()
request.addfinalizer(teardown)
full error description:
Traceback (most recent call last):
File "/Users/anton/MercuryTest/mercury_env/lib/python3.6/site-packages/_pytest/config/__init__.py", line 415, in _importconftest
return self._conftestpath2mod[conftestpath]
KeyError: local('/Users/anton/autotests/conftest.py')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Applications/PyCharm CE.app/Contents/helpers/pycharm/_jb_pytest_runner.py", line 31, in <module>
pytest.main(args, plugins_to_load)
File "/Users/anton/MercuryTest/mercury_env/lib/python3.6/site-packages/_pytest/config/__init__.py", line 55, in main
config = _prepareconfig(args, plugins)
File "/Users/anton/MercuryTest/mercury_env/lib/python3.6/site-packages/_pytest/config/__init__.py", line 200, in _prepareconfig
pluginmanager=pluginmanager, args=args
File "/Users/anton/MercuryTest/mercury_env/lib/python3.6/site-packages/pluggy/hooks.py", line 289, in _call_
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "/Users/anton/MercuryTest/mercury_env/lib/python3.6/site-packages/pluggy/manager.py", line 87, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/Users/anton/MercuryTest/mercury_env/lib/python3.6/site-packages/pluggy/manager.py", line 81, in <lambda>
firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
File "/Users/anton/MercuryTest/mercury_env/lib/python3.6/site-packages/pluggy/callers.py", line 203, in _multicall
gen.send(outcome)
File "/Users/anton/MercuryTest/mercury_env/lib/python3.6/site-packages/_pytest/helpconfig.py", line 89, in pytest_cmdline_parse
config = outcome.get_result()
File "/Users/anton/MercuryTest/mercury_env/lib/python3.6/site-packages/pluggy/callers.py", line 80, in get_result
raise ex[1].with_traceback(ex[2])
File "/Users/anton/MercuryTest/mercury_env/lib/python3.6/site-packages/pluggy/callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "/Users/anton/MercuryTest/mercury_env/lib/python3.6/site-packages/_pytest/config/__init__.py", line 661, in pytest_cmdline_parse
self.parse(args)
File "/Users/anton/MercuryTest/mercury_env/lib/python3.6/site-packages/_pytest/config/__init__.py", line 869, in parse
self._preparse(args, addopts=addopts)
File "/Users/anton/MercuryTest/mercury_env/lib/python3.6/site-packages/_pytest/config/__init__.py", line 825, in _preparse
early_config=self, args=args, parser=self._parser
File "/Users/anton/MercuryTest/mercury_env/lib/python3.6/site-packages/pluggy/hooks.py", line 289, in _call_
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "/Users/anton/MercuryTest/mercury_env/lib/python3.6/site-packages/pluggy/manager.py", line 87, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/Users/anton/MercuryTest/mercury_env/lib/python3.6/site-packages/pluggy/manager.py", line 81, in <lambda>
firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
File "/Users/anton/MercuryTest/mercury_env/lib/python3.6/site-packages/pluggy/callers.py", line 208, in _multicall
return outcome.get_result()
File "/Users/anton/MercuryTest/mercury_env/lib/python3.6/site-packages/pluggy/callers.py", line 80, in get_result
raise ex[1].with_traceback(ex[2])
File "/Users/anton/MercuryTest/mercury_env/lib/python3.6/site-packages/pluggy/callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "/Users/anton/MercuryTest/mercury_env/lib/python3.6/site-packages/_pytest/config/__init__.py", line 724, in pytest_load_initial_conftests
self.pluginmanager._set_initial_conftests(early_config.known_args_namespace)
File "/Users/anton/MercuryTest/mercury_env/lib/python3.6/site-packages/_pytest/config/__init__.py", line 364, in _set_initial_conftests
self._try_load_conftest(anchor)
File "/Users/anton/MercuryTest/mercury_env/lib/python3.6/site-packages/_pytest/config/__init__.py", line 370, in _try_load_conftest
self._getconftestmodules(anchor)
File "/Users/anton/MercuryTest/mercury_env/lib/python3.6/site-packages/_pytest/config/__init__.py", line 399, in _getconftestmodules
mod = self._importconftest(conftestpath.realpath())
File "/Users/anton/MercuryTest/mercury_env/lib/python3.6/site-packages/_pytest/config/__init__.py", line 449, in _importconftest
self.consider_conftest(mod)
File "/Users/anton/MercuryTest/mercury_env/lib/python3.6/site-packages/_pytest/config/__init__.py", line 502, in consider_conftest
self.register(conftestmodule, name=conftestmodule.__file__)
File "/Users/anton/MercuryTest/mercury_env/lib/python3.6/site-packages/_pytest/config/__init__.py", line 302, in register
ret = super().register(plugin, name)
File "/Users/anton/MercuryTest/mercury_env/lib/python3.6/site-packages/pluggy/manager.py", line 121, in register
hook._maybe_apply_history(hookimpl)
File "/Users/anton/MercuryTest/mercury_env/lib/python3.6/site-packages/pluggy/hooks.py", line 336, in _maybe_apply_history
res = self._hookexec(self, [method], kwargs)
File "/Users/anton/MercuryTest/mercury_env/lib/python3.6/site-packages/pluggy/manager.py", line 87, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/Users/anton/MercuryTest/mercury_env/lib/python3.6/site-packages/pluggy/manager.py", line 81, in <lambda>
firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
File "/Users/anton/MercuryTest/mercury_env/lib/python3.6/site-packages/pluggy/callers.py", line 208, in _multicall
return outcome.get_result()
File "/Users/anton/MercuryTest/mercury_env/lib/python3.6/site-packages/pluggy/callers.py", line 80, in get_result
raise ex[1].with_traceback(ex[2])
File "/Users/anton/MercuryTest/mercury_env/lib/python3.6/site-packages/pluggy/callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "/Users/anton/MercuryTest/mercury_env/lib/python3.6/site-packages/pytest_testrail/conftest.py", line 20, in pytest_addoption
help='Create and update testruns with TestRail')
File "/Users/anton/MercuryTest/mercury_env/lib/python3.6/site-packages/_pytest/config/argparsing.py", line 304, in addoption
raise ValueError("option names %s already added" % conflict)
ValueError: option names {'--testrail'} already added
here example of my test cases with all decorators:
import pytest
import allure
from pytest_testrail.plugin import pytestrail
#pytest.mark.usefixtures('driver_setup')
#allure.epic('application name ')
class Test_app_name:
#allure.feature('feature')
#pytestrail.case('C850')
#allure.title('test title')
#allure.severity(allure.severity_level.CRITICAL)
def test_case_name(self):
page = pageObjectClassWithLocatorsAndActions(self.driver)
with allure.step('step'):
page.do_something()
It maybe duplicate with issue described here Pytest Testrail Module - Post Test Results for Test Runs
If so, you don't need to import "pytest_testrail.conftest" in your own conftest
You need assert something in "page.do_something()" to testrail plugin knows the status of "test_case_name"
I'm trying to implement the pytest plugin mentioned in https://github.com/pytest-dev/pytest/issues/2039, basically this plugin will print all tests that pytest finds:
## pytest_collector.py
import sys
import pytest
class DkPytestCollector(object):
def __init__(self):
self.collected = []
def pytest_collection_modifyitems(self, items):
for item in items:
self.collected.append(item.nodeid)
if __name__ == '__main__':
dkpytest_collector = DkPytestCollector()
directory = sys.argv[1]
pytest.main(['--collect-only', directory], plugins=[dkpytest_collector])
print('\n\nfound:')
for nodeid in dkpytest_collector.collected:
print(nodeid)
however, when I run it I get:
(dk) go|c:\srv\lib\dk> python ..\dkbuild\dkbuild\pytest_collector.py \srv\lib\dk
Traceback (most recent call last):
File "..\dkbuild\dkbuild\pytest_collector.py", line 20, in <module>
pytest.main(['--collect-only', directory], plugins=[dkpytest_collector])
File "c:\srv\venv\dk\lib\site-packages\_pytest\config.py", line 50, in main
config = _prepareconfig(args, plugins)
File "c:\srv\venv\dk\lib\site-packages\_pytest\config.py", line 160, in _prepareconfig
pluginmanager=pluginmanager, args=args)
File "c:\srv\venv\dk\lib\site-packages\pluggy\__init__.py", line 617, in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
File "c:\srv\venv\dk\lib\site-packages\pluggy\__init__.py", line 222, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "c:\srv\venv\dk\lib\site-packages\pluggy\__init__.py", line 216, in <lambda>
firstresult=hook.spec_opts.get('firstresult'),
File "c:\srv\venv\dk\lib\site-packages\pluggy\callers.py", line 196, in _multicall
gen.send(outcome)
File "c:\srv\venv\dk\lib\site-packages\_pytest\helpconfig.py", line 68, in pytest_cmdline_parse
config = outcome.get_result()
File "c:\srv\venv\dk\lib\site-packages\pluggy\callers.py", line 77, in get_result
_reraise(*ex) # noqa
File "c:\srv\venv\dk\lib\site-packages\pluggy\callers.py", line 180, in _multicall
res = hook_impl.function(*args)
File "c:\srv\venv\dk\lib\site-packages\_pytest\config.py", line 943, in pytest_cmdline_parse
self.parse(args)
File "c:\srv\venv\dk\lib\site-packages\_pytest\config.py", line 1108, in parse
self._preparse(args, addopts=addopts)
File "c:\srv\venv\dk\lib\site-packages\_pytest\config.py", line 1071, in _preparse
self.pluginmanager.load_setuptools_entrypoints('pytest11')
File "c:\srv\venv\dk\lib\site-packages\pluggy\__init__.py", line 397, in load_setuptools_entrypoints
plugin = ep.load()
File "c:\srv\venv\dk\lib\site-packages\pkg_resources\__init__.py", line 2405, in load
return self.resolve()
File "c:\srv\venv\dk\lib\site-packages\pkg_resources\__init__.py", line 2411, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "c:\srv\venv\dk\lib\site-packages\_pytest\assertion\rewrite.py", line 212, in load_module
py.builtin.exec_(co, mod.__dict__)
File "c:\srv\venv\dk\lib\site-packages\py\_builtin.py", line 221, in exec_
exec2(obj, globals, locals)
File "<string>", line 7, in exec2
File "c:\srv\venv\dk\lib\site-packages\pytest_cov\plugin.py", line 6, in <module>
from coverage.misc import CoverageException
ImportError: No module named misc
if I pip uninstall pytest-cov everything works (well, except no coverage..)
How do I get this to work without uninstalling pytest-cov?
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!
When I starts Python 2.7+Django app and try to go http://127.0.0.1:8000/admin/ I see only text without normal display.
It happens only winth Python 2.7. When I use Python 3.3 everything is OK. But I need exactly Python 2.7.
Here is my errors
[19/Mar/2014 12:39:00] "GET /admin/ HTTP/1.1" 200 2990
Traceback (most recent call last):
File "C:\Python27\lib\wsgiref\handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File "C:\Python27\lib\site-packages\django\contrib\staticfiles\handlers.py", line 68, in __call__
return super(StaticFilesHandler, self).__call__(environ, start_response)
File "C:\Python27\lib\site-packages\django\core\handlers\wsgi.py", line 206, in __call__
response = self.get_response(request)
File "C:\Python27\lib\site-packages\django\contrib\staticfiles\handlers.py", line 58, in get_response
return self.serve(request)
File "C:\Python27\lib\site-packages\django\contrib\staticfiles\handlers.py", line 51, in serve
return serve(request, self.file_path(request.path), insecure=True)
File "C:\Python27\lib\site-packages\django\contrib\staticfiles\views.py", line 41, in serve
return static.serve(request, path, document_root=document_root, **kwargs)
File "C:\Python27\lib\site-packages\django\views\static.py", line 61, in serve
content_type, encoding = mimetypes.guess_type(fullpath)
File "C:\Python27\lib\mimetypes.py", line 297, in guess_type
init()
File "C:\Python27\lib\mimetypes.py", line 358, in init
db.read_windows_registry()
File "C:\Python27\lib\mimetypes.py", line 258, in read_windows_registry
for subkeyname in enum_types(hkcr):
File "C:\Python27\lib\mimetypes.py", line 249, in enum_types
ctype = ctype.encode(default_encoding) # omit in 3.x!
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd8 in position 0: ordinal not in range(128)
Traceback (most recent call last):
File "C:\Python27\lib\wsgiref\handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File "C:\Python27\lib\site-packages\django\contrib\staticfiles\handlers.py", line 68, in __call__
return super(StaticFilesHandler, self).__call__(environ, start_response)
File "C:\Python27\lib\site-packages\django\core\handlers\wsgi.py", line 206, in __call__
response = self.get_response(request)
File "C:\Python27\lib\site-packages\django\contrib\staticfiles\handlers.py", line 58, in get_response
return self.serve(request)
File "C:\Python27\lib\site-packages\django\contrib\staticfiles\handlers.py", line 51, in serve
return serve(request, self.file_path(request.path), insecure=True)
File "C:\Python27\lib\site-packages\django\contrib\staticfiles\views.py", line 41, in serve
return static.serve(request, path, document_root=document_root, **kwargs)
File "C:\Python27\lib\site-packages\django\views\static.py", line 61, in serve
content_type, encoding = mimetypes.guess_type(fullpath)
File "C:\Python27\lib\mimetypes.py", line 297, in guess_type
init()
File "C:\Python27\lib\mimetypes.py", line 358, in init
db.read_windows_registry()
File "C:\Python27\lib\mimetypes.py", line 258, in read_windows_registry
for subkeyname in enum_types(hkcr):
File "C:\Python27\lib\mimetypes.py", line 249, in enum_types
ctype = ctype.encode(default_encoding) # omit in 3.x!
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd8 in position 0: ordinal not in range(128)
Help me please!
you can use vim or other text editor which can tell the 16bit coding check the view and the template file again.I
I find answer! It needed create file sitecustomize.py C:\Python27\Lib\site-packages.
And write there:
import sys
sys.setdefaultencoding("cp1251")
And all works)