How to fix 'UnicodeDecodeError' in 'envreport' when running tox? - python

I want to use tox to automate testing of my python package. As of now, just locally. When running tox, the test passes, but then a UnicodeDecodeError is thrown. tox --version is 3.13.2.
The error message (full traceback below):
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe4 in position 70: invalid continuation byte
The tests succeed when running tox, which is visualize with -vvvvvv, which I expect. The functions do not do anything and are just a dummy at the moment (Automatically created using the cookiecutter-pypackage). I reduced the items in the envlist to just py37. Anaconda is in my PATH variable and no regular python is installed. I tried using different python versions by writing a .bat (i am using Windows) like on the official tox documentation. This works identically to the py37. Test pass and the following is thrown.
I could not find anything in the tox documentation regarding UnicodeDecodeErrors.
Neither powershell or my commandline can execute export LANG=en_US.UTF-8 as suggested in this post. Setting setenv = LANG=en_US.UTF-8 in the tox.ini also did not change anything.
The Traceback below is for the py37 environment, which gets called when adding skipdist = true to tox.ini. Leaving that out will still return the exact same error, with an almost identical traceback.
The error is thrown from codecy.py file. Moving up in the Traceback and looking into each file didn't help me, as i could not find out, which file gets encoded or anything else, which could help. Without posting the whole console output with the successful virtualenv creation, something could help. The Error is thrown on the envreport in the summary. tox-envreport is not installed if that matters. When the sdist gets tested, it is in the GLOB sdist-make: section.
py37 finish: finishvenv after 0.02 seconds
py37 start: envreport
setting PATH=C:\Users\cosmo\OneDrive - Universität zu Köln\package\.tox\py37\Scripts;C:\Users\cosmo\Anaconda3;C:\Users\cosmo\Anaconda3\Library\mingw-w64\bin;C:\Users\cosmo\Anaconda3\Library\usr\bin;C:\Users\cosmo\Anaconda3\Library\bin;C:\Users\cosmo\Anaconda3\Scripts;C:\Users\cosmo\Anaconda3\bin;C:\Users\cosmo\Anaconda3\condabin;C:\ProgramData\DockerDesktop\version-bin;C:\Program Files\Docker\Docker\Resources\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\Git\cmd;C:\Program Files\MATLAB\R2019a\bin;C:\Program Files\PuTTY;C:\Program Files\MiKTeX 2.9\miktex\bin\x64;C:\Users\cosmo\AppData\Local\Microsoft\WindowsApps;C:\Users\cosmo\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\cosmo\AppData\Local\GitHubDesktop\bin;C:\Users\cosmo\Anaconda3\Scripts;C:\Users\cosmo\Anaconda3;.
[7836] C:\Users\cosmo\OneDrive - Universität zu Köln\package$ 'C:\Users\cosmo\OneDrive - Universität zu Köln\package\.tox\py37\Scripts\python.EXE' -m pip freeze >.tox\py37\log\py37-0.log
_________________________________________________________________________ summary __________________________________________________________________________
py37: commands succeeded
congratulations :)
Traceback (most recent call last):
File "c:\users\cosmo\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\cosmo\anaconda3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\cosmo\Anaconda3\Scripts\tox.exe\__main__.py", line 9, in <module>
File "c:\users\cosmo\anaconda3\lib\site-packages\tox\session\__init__.py", line 44, in cmdline
main(args)
File "c:\users\cosmo\anaconda3\lib\site-packages\tox\session\__init__.py", line 68, in main
exit_code = session.runcommand()
File "c:\users\cosmo\anaconda3\lib\site-packages\tox\session\__init__.py", line 192, in runcommand
return self.subcommand_test()
File "c:\users\cosmo\anaconda3\lib\site-packages\tox\session\__init__.py", line 220, in subcommand_test
run_sequential(self.config, self.venv_dict)
File "c:\users\cosmo\anaconda3\lib\site-packages\tox\session\commands\run\sequential.py", line 20, in run_sequential
runenvreport(venv, config)
File "c:\users\cosmo\anaconda3\lib\site-packages\tox\session\commands\run\sequential.py", line 60, in runenvreport
packages = config.pluginmanager.hook.tox_runenvreport(venv=venv, action=action)
File "c:\users\cosmo\anaconda3\lib\site-packages\pluggy\hooks.py", line 289, in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "c:\users\cosmo\anaconda3\lib\site-packages\pluggy\manager.py", line 87, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "c:\users\cosmo\anaconda3\lib\site-packages\pluggy\manager.py", line 81, in <lambda>
firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
File "c:\users\cosmo\anaconda3\lib\site-packages\pluggy\callers.py", line 208, in _multicall
return outcome.get_result()
File "c:\users\cosmo\anaconda3\lib\site-packages\pluggy\callers.py", line 80, in get_result
raise ex[1].with_traceback(ex[2])
File "c:\users\cosmo\anaconda3\lib\site-packages\pluggy\callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "c:\users\cosmo\anaconda3\lib\site-packages\tox\venv.py", line 780, in tox_runenvreport
output = venv._pcall(args, cwd=venv.envconfig.config.toxinidir, action=action, returnout=True)
File "c:\users\cosmo\anaconda3\lib\site-packages\tox\venv.py", line 574, in _pcall
report_fail=not is_test_command,
File "c:\users\cosmo\anaconda3\lib\site-packages\tox\action.py", line 107, in popen
lines = out_path.read_text("UTF-8").split("\n")
File "c:\users\cosmo\anaconda3\lib\site-packages\py\_path\common.py", line 165, in read_text
return f.read()
File "c:\users\cosmo\anaconda3\lib\codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe4 in position 70: invalid continuation byte
My question:
How can i fix this?
What file may be the reason for this (seemingly bad enconding)?

Just a guess.
Place your application outside this folder: OneDrive - Universität zu Köln
The problem in Köln I think.
This is good traceback to feel tox bug report.

Related

MassWappalyzer: can't run the script

Has anyone tried tried to run MassWappalyzer?
From GitHub: **https://github.com/tristanlatr/MassWappalyzer
**
Hi,
I am trying to run MassWappalyzer on my terminal. i have already installed everything and got my MassWappalyzer folder installed, with the script, samples, etc.
However, when I try running the command python3 -m masswappalyzer -i websites.txt -o websites.xlsx
It states this:
Mass Wappalyzer
Using python-Wappalyzer
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "/Users/andreualegre/MassWappalyzer/masswappalyzer.py", line 408, in
main()
File "/Users/andreualegre/MassWappalyzer/masswappalyzer.py", line 401, in main
mass_w = MassWappalyzer(urls, **args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/andreualegre/MassWappalyzer/masswappalyzer.py", line 281, in init
self.analyzer = WappalyzerWrapper(
^^^^^^^^^^^^^^^^^^
File "/Users/andreualegre/MassWappalyzer/masswappalyzer.py", line 247, in init
self._analyze = PythonWappalyzer().analyze
^^^^^^^^^^^^^^^^^^
File "/Users/andreualegre/MassWappalyzer/masswappalyzer.py", line 185, in init
self._wappalyzer = self.Wappalyzer.Wappalyzer.latest(update=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Wappalyzer.latest() got an unexpected keyword argument 'update'
Can anyone help me out?
Thank you!
I have already installed everything and tried different ways to run this code. However, couldn't be able to get the solution. I have also asked the dev fro GitHub's, but he haven't answered yet, that's why I am asking here.

snapcraft gives 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)

I try to compile Qt 5.13 in a snap package, but I get the following error when priming it:
'NoneType' object has no attribute 'decode'
I thought that this is related to some internationalization issues in the underlying python code, so tried to change the build order, did a lot of other things, but every time we get back the error above.
The following is the snapcraft file:
name: vcs
version: '2.0'
summary: VCS GUI
description: |
Maritime Robotics Vehicle Control System GUI
confinement: devmode
base: core18
layout:
/usr/lib/vcs-gui/plugins:
bind: $SNAP/usr/lib/vcs-gui/plugins
parts:
desktop-qt5:
source: https://download.qt.io/archive/qt/5.13/5.13.2/single/qt-everywhere-src-5.13.2.tar.xz
plugin: dump
override-build: |
snapcraftctl build
./configure -opensource -confirm-license -debug -nomake examples -nomake tests
make
make install
override-prime: |
locale-gen "en_US.UTF-8"
update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
snapcraftctl prime
build-packages:
- python
- locales
protobuf:
source: https://github.com/protocolbuffers/protobuf/releases/download/v3.8.0/protobuf-all-3.8.0.tar.gz
plugin: autotools
cmake:
source: https://github.com/Kitware/CMake/releases/download/v3.15.0-rc1/cmake-3.15.0-rc1.tar.gz
plugin: autotools
libproj:
source: http://download.osgeo.org/proj/proj-6.0.0.tar.gz
plugin: autotools
build-packages:
- libsqlite3-dev
- sqlite3
- libgl1-mesa-dev
- libglu1-mesa-dev
gdal:
source: https://github.com/OSGeo/gdal/releases/download/v3.0.0/gdal-3.0.0.tar.gz
plugin: autotools
after: [libproj]
ecc:
source: https://confluence.ecmwf.int/download/attachments/45757960/eccodes-2.12.5-Source.tar.gz
plugin: cmake
configflags: [-DENABLE_FORTRAN=OFF]
vcs:
plugin: cmake
configflags: [-DQt5Core_DIR=/usr/local/Qt-5.13.2/lib/cmake/Qt5Core,-DQt5_DIR=/usr/local/Qt-5.13.2/lib/cmake/Qt5,-DQT_QMAKE_EXECUTABLE=/usr/local/Qt-5.13.2/bin/qmake]
source: https://github.com/fritzone/Qt-CMake-HelloWorld.git
after: [protobuf,cmake,libproj,gdal,ecc,desktop-qt5]
build-packages:
- git
- g++
- make
- libkml-dev
- libarmadillo-dev
- libgeographic-dev
- libssl-dev
- libconfig++-dev
- libxml2-dev
- libmodbus-dev
- libev-dev
- libudev-dev
- libexiv2-dev
- libv4l-dev
- doxygen
- graphviz
- libgeotiff-dev
- libgeos-dev
- libpng-dev
- libbotan-2-dev
stage-packages:
- libbotan-2-4
- libtspi1
- libkmlconvenience1
- libkmlbase1
- libkmlengine1
- libkmldom1
- libssl1.0.0
- libconfig++9v5
- libxml2
- libmodbus5
- libev4
- libaec0
- libhdf4-0-alt
- libsz2
- libexiv2-14
- libv4l-0
- libgeotiff2
- libsdl2-2.0-0
- libxcb-xinerama0
- libarmadillo8
- libarpack2
- libsuperlu5
- libgeos-3.6.2
- libgeos-c1v5
apps:
vcs:
command: bin/desktop-launch bin/vcs
adapter: full
command-chain:
- bin/desktop-launch
- bin/vcs
common-id: vcs-gui.desktop
desktop: usr/share/applications/vcs-gui.desktop
environment:
"DISABLE_WAYLAND": "0"
plugs: [x11, wayland, desktop, desktop-legacy, opengl, network, home]
Here is the output I get from it when I run with:
SNAPCRAFT_ENABLE_DEVELOPER_DEBUG=yes SNAPCRAFT_BUILD_ENVIRONMENT_MEMORY=8G snapcraft --debug
(Yes, it needs circa 8GB of memory due to the compiler crashing while building Qt)
.
. // everything is fine till this point
.
Priming desktop-qt5
Generating locales (this might take a while)...
en_US.UTF-8... done
Generation complete.
'NoneType' object has no attribute 'decode'
We would appreciate it if you anonymously reported this issue.
No other data than the traceback and the version of snapcraft in use will be sent.
And here is the stacktrace of the python script which tries to build the package:
'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)
We would appreciate it if you anonymously reported this issue.
No other data than the traceback and the version of snapcraft in use will be sent.
Would you like to send this error data? (Yes/No/Always/View) [no]: View
Traceback (most recent call last):
File "/snap/snapcraft/3440/bin/snapcraft", line 11, in <module>
load_entry_point('snapcraft==3.8', 'console_scripts', 'snapcraft')()
File "/snap/snapcraft/3440/lib/python3.5/site-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/snap/snapcraft/3440/lib/python3.5/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/snap/snapcraft/3440/lib/python3.5/site-packages/click/core.py", line 1114, in invoke
return Command.invoke(self, ctx)
File "/snap/snapcraft/3440/lib/python3.5/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/snap/snapcraft/3440/lib/python3.5/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/snap/snapcraft/3440/lib/python3.5/site-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/cli/_runner.py", line 103, in run
snap_command.invoke(ctx)
File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/cli/_command.py", line 87, in invoke
return super().invoke(ctx)
File "/snap/snapcraft/3440/lib/python3.5/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/snap/snapcraft/3440/lib/python3.5/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/cli/lifecycle.py", line 261, in snap
_execute(steps.PRIME, parts=[], pack_project=True, output=output, **kwargs)
File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/cli/lifecycle.py", line 66, in _execute
lifecycle.execute(step, project_config, parts)
File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/internal/lifecycle/_runner.py", line 94, in execute
executor.run(step, part_names)
File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/internal/lifecycle/_runner.py", line 148, in run
self._handle_step(part_names, part, step, current_step, cli_config)
File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/internal/lifecycle/_runner.py", line 162, in _handle_step
getattr(self, "_run_{}".format(current_step.name))(part)
File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/internal/lifecycle/_runner.py", line 237, in _run_prime
self._run_step(step=steps.PRIME, part=part, progress="Priming")
File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/internal/lifecycle/_runner.py", line 281, in _run_step
getattr(part, step.name)()
File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 795, in prime
self._do_runner_step(steps.PRIME)
File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 242, in _do_runner_step
return getattr(self._runner, "{}".format(step.name))()
File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/internal/pluginhandler/_runner.py", line 91, in prime
"override-prime", self._override_prime_scriptlet, self._primedir
File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/internal/pluginhandler/_runner.py", line 137, in _run_scriptlet
scriptlet_name, function_call.strip()
File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/internal/pluginhandler/_runner.py", line 193, in _handle_builtin_function
function(**function_args)
File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 807, in _do_prime
dependency_paths = self._handle_elf(snap_files)
File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 814, in _handle_elf
elf_files = elf.get_elf_files(self.primedir, snap_files)
File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/internal/elf.py", line 576, in get_elf_files
elf_file = ElfFile(path=path)
File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/internal/elf.py", line 219, in __init__
elf_data = self._extract(path)
File "/snap/snapcraft/3440/lib/python3.5/site-packages/snapcraft/internal/elf.py", line 252, in _extract
interp_section = elf.get_section_by_name(_INTERP)
File "/snap/snapcraft/3440/lib/python3.5/site-packages/elftools/elf/elffile.py", line 94, in get_section_by_name
for i, sec in enumerate(self.iter_sections()):
File "/snap/snapcraft/3440/lib/python3.5/site-packages/elftools/elf/elffile.py", line 103, in iter_sections
yield self.get_section(i)
File "/snap/snapcraft/3440/lib/python3.5/site-packages/elftools/elf/elffile.py", line 83, in get_section
return self._make_section(section_header)
File "/snap/snapcraft/3440/lib/python3.5/site-packages/elftools/elf/elffile.py", line 288, in _make_section
name = self._get_section_name(section_header)
File "/snap/snapcraft/3440/lib/python3.5/site-packages/elftools/elf/elffile.py", line 283, in _get_section_name
return self._file_stringtable_section.get_string(name_offset)
File "/snap/snapcraft/3440/lib/python3.5/site-packages/elftools/elf/sections.py", line 70, in get_string
return s.decode('ascii')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)
We would appreciate it if you anonymously reported this issue.
Does anyone have any ideas on how to make it work? Please note, using the Qt which comes with default base core18 (5.9) is not good for our application due to some bugs that were fixed in 5.13, so we need at least 5.13.
The application this tries to build is just a helloworld app, it's not relevant to the error we get, but it's required by snapcraft to reach the stage of the error.
(Be careful if you try to run snapcraft against this file, Qt takes 4 - 5 hours on my computer to compile)
In the traceback, a get_string function is raising a UnicodeDecodeError because it can't decode some text from ASCII.
In the current source for elftools, this line has been replaced by
return s.decode('UTF-8') is else ''
So you could try upgrading the version of pyelftools bundled with snap
<the python interpreter bundled with snap> -m pip install --upgrade pyelftools
(ensure you can roll back, in case this upgrade actually makes things worse)

Python Behave BDD Tutorial Error on Windows

So, I`m comparing some python test frameworks and came across behave. Thought it was interesting and worth a test drive.
Followed the steps on the tutorial, available at:
https://behave.readthedocs.io/en/stable/tutorial.html
When I ran the behave command on Powershell (Win10 and Python 2.7.10), I got the following error:
Exception TypeError: compile() expected string without null bytes
Traceback (most recent call last):
File "C:\Python27\lib\runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "C:\Python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\lib\site-packages\behave\__main__.py", line 187, in <module>
sys.exit(main())
File "C:\Python27\lib\site-packages\behave\__main__.py", line 183, in main
return run_behave(config)
File "C:\Python27\lib\site-packages\behave\__main__.py", line 127, in run_behave
failed = runner.run()
File "C:\Python27\lib\site-packages\behave\runner.py", line 804, in run
return self.run_with_paths()
File "C:\Python27\lib\site-packages\behave\runner.py", line 809, in run_with_paths
self.load_step_definitions()
File "C:\Python27\lib\site-packages\behave\runner.py", line 796, in load_step_definitions
load_step_modules(step_paths)
File "C:\Python27\lib\site-packages\behave\runner_util.py", line 412, in load_step_modules
exec_file(os.path.join(path, name), step_module_globals)
File "C:\Python27\lib\site-packages\behave\runner_util.py", line 385, in exec_file
code = compile(f.read(), filename2, "exec", dont_inherit=True)
TypeError: compile() expected string without null bytes
Has anyone encountered this error while trying to run behave? (Found some threads online related mainly to flask issues but I couldn't solve the problem)
Answering my own question here.
It was an encoding problem.
Sublime was saving my files with an encoding different from UTF-8.
File -> Save with Encoding -> UTF-8 did the trick.

rabbitmqadmin can't handle unicode?

I might have stumbled into something that appears to be a bug with how rabbitmqadmin handles (or in fact, doesn't handle) unicode.
If I have a queue that has unicode characters in queue name the rabbitmqadmin command fails with UnicodeEncodeErrors.
I'm running RabbitMQ 3.6.6 on Mac, installed via Homebrew. Both the admin command and server are of same version.
Steps how to reproduce the queue name issue:
Create a queue with unicode in it: 'rabbitmqadmin declare queue name=ööö'.
List queues: 'rabbitmqadmin list queues'
Output:
Traceback (most recent call last):
File "/usr/local/sbin/rabbitmqadmin", line 1007, in <module>
main()
File "/usr/local/sbin/rabbitmqadmin", line 413, in main
method()
File "/usr/local/sbin/rabbitmqadmin", line 588, in invoke_list
format_list(self.get(uri), cols, obj_info, self.options)
File "/usr/local/sbin/rabbitmqadmin", line 705, in format_list
formatter_instance.display(json_list)
File "/usr/local/sbin/rabbitmqadmin", line 716, in display
(columns, table) = self.list_to_table(json.loads(json_list), depth)
File "/usr/local/sbin/rabbitmqadmin", line 770, in list_to_table
add('', 1, item, add_to_row)
File "/usr/local/sbin/rabbitmqadmin", line 749, in add
fun(column, subitem)
File "/usr/local/sbin/rabbitmqadmin", line 756, in add_to_row
row[column_ix[col]] = str(val)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 12-13: ordinal not in range(128)
I have similar issues with 'rabbitmqadmin get queue=' when the message payload contains unicode character(s).
I think you are right, you can use python3 , check this answer it explains why with python3 works.
EDIT
1 - I filed an issue
2 - Fixed to the version: 3.6.7 see the PR

Mysterious "embedded null byte" error

Working on a fairly large/complex Django project with a team, we occasionally see runserver crash with ValueError: embedded null byte. We restart runserver and it's fine - either for a few minutes or a few days. We can detect no pattern to what causes the crashes (seems totally random). Fortunately it's only happening in local development, not on our servers, but I'm worried that it will bite us down the road.
The stack trace below does not point to any location in our code -- seems to come either from Django or the virtualenv itself.
Using Django 1.9.8, Python 3.5.0, on El Capitan.
I can't see any way to debug this. Theories?
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/path/to/virtualenvs/ourproj/lib/python3.5/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
utility.execute()
File "/path/to/virtualenvs/ourproj/lib/python3.5/site-packages/django/core/management/__init__.py", line 345, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/path/to/virtualenvs/ourproj/lib/python3.5/site-packages/django/core/management/base.py", line 348, in run_from_argv
self.execute(*args, **cmd_options)
File "/path/to/virtualenvs/ourproj/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 54, in execute
super(Command, self).execute(*args, **options)
File "/path/to/virtualenvs/ourproj/lib/python3.5/site-packages/django/core/management/base.py", line 399, in execute
output = self.handle(*args, **options)
File "/path/to/virtualenvs/ourproj/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 93, in handle
self.run(**options)
File "/path/to/virtualenvs/ourproj/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 102, in run
autoreload.main(self.inner_run, None, options)
File "/path/to/virtualenvs/ourproj/lib/python3.5/site-packages/django/utils/autoreload.py", line 333, in main
reloader(wrapped_main_func, args, kwargs)
File "/path/to/virtualenvs/ourproj/lib/python3.5/site-packages/django/utils/autoreload.py", line 299, in python_reloader
reloader_thread()
File "/path/to/virtualenvs/ourproj/lib/python3.5/site-packages/django/utils/autoreload.py", line 275, in reloader_thread
change = fn()
File "/path/to/virtualenvs/ourproj/lib/python3.5/site-packages/django/utils/autoreload.py", line 204, in code_changed
for filename in gen_filenames():
File "/path/to/virtualenvs/ourproj/lib/python3.5/site-packages/django/utils/autoreload.py", line 114, in gen_filenames
basedirs = [os.path.abspath(basedir) for basedir in basedirs
File "/path/to/virtualenvs/ourproj/lib/python3.5/site-packages/django/utils/autoreload.py", line 115, in <listcomp>
if os.path.isdir(basedir)]
File "/path/to/virtualenvs/ourproj/bin/../lib/python3.5/genericpath.py", line 42, in isdir
st = os.stat(s)
ValueError: embedded null byte
One of the AppConfig objects has null byte in its path attribute.
One of the LOCALE_PATHS has null byte.
One of the files is in the "wrong" encoding, so Django treats something has null byte (e. g. AppConfig.path).
One of the files or directories in project directory has null byte (\x00) in its name.
Other reason.
autoreload.py lines related to this issue. os.path.isdir() raises ValueError: embedded null byte if its argument has null byte, e. g. os.path.isdir('foo\x00bar').
You can try to edit autoreload.py, comment out these lines temporarily:
basedirs = [os.path.abspath(basedir) for basedir in basedirs
if os.path.isdir(basedir)]
and add this:
temp_basedirs = []
for basedir in basedirs:
try:
if os.path.isdir(basedir):
temp_basedirs.append(os.path.abspath(basedir))
except ValueError:
print(basedir)
raise
basedirs = temp_basedirs

Categories

Resources