0
與一個團隊一起處理相當大/複雜的Django項目時,偶爾會看到runserver與ValueError: embedded null byte
崩潰。我們重新啓動runserver,這很好 - 無論是幾分鐘還是幾天。我們可以檢測到沒有模式導致崩潰(似乎完全隨機)。幸運的是,它只發生在本地開發中,而不是在我們的服務器上,但我擔心它會讓我們陷入困境。神祕的「嵌入式空字節」錯誤
下面的堆棧跟蹤沒有指向我們代碼中的任何位置 - 似乎來自Django或virtualenv本身。
在El Capitan上使用Django 1.9.8,Python 3.5.0。
我看不到任何方式來調試這個。理論?
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
有趣的 - 所以你認爲這是一個文件名的問題,而不是代碼? – shacker
@shacker編輯。 – vd1
所以我嘗試了這個,從項目目錄和virtualenv目錄。在virtualenv dir中,我發現了這個:「找到。 -name「[^ \ x00]」 。 。/ lib/python3.5/site-packages/compressor/tests/static/css/url/2'。我點pip卸載,然後重新安裝該軟件包,但發現仍然打開它,所以我會提醒該軟件包的開發人員。 – shacker