Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#30921 closed Bug (duplicate)

_DeadlockError is raised when using StatReloader.

Reported by: Man Python Owned by: nobody
Component: Utilities Version: 2.2
Severity: Normal Keywords: makemigrations migrate WindowsError
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

There is many issues around this type error:
WindowsError: [Error 123] The filename, directory name, or volume label syntax is incorrect: '<frozen importlib._bootstrap>'
https://stackoverflow.com/questions/56166319/python-django-error-oserror-winerror-123-the-filename-directory-name-or-vol
https://github.com/pytest-dev/pytest-django/issues/641
https://stackoverflow.com/questions/57108779/how-to-solve-oserror-winerror-123-the-filename-directory-name-or-volume-lab

Most of issues don't have any solutions and are not solved and no any sense sugestions.

What I discover..

This is happen when we often doing makemigrations and migrate with variable way as
makemigrations myapp and migrate
or
makemigrations myapp and migrate myapp
or
makemigrations and migrate myapp
or
makemigrations and migrate

The change db from sqlite to mysql and in diffrent way made this same bug.
Some times python -mpip install --force-reinstall -I django solved error, in other situations not.. don't know why and what is relation in this, but reading sugestions 2 times this helped me, and in next progress of project not.

The cmd python manage.py runserver doing this error, but e.q. this same cmd via Visual Studio Code not return this errors
https://github.com/microsoft/ptvsd/issues/1866
Adding parameter python manage.py runserver --nothreading still this same error but python manage.py runserver --noreload ommiting error in case that working with this mode in dev is not comfy.
Coz VSC has some bug in debug around static then must fighting with this all. Django made me sad :(

Change History (4)

comment:1 by Man Python, 5 years ago

Example of log

python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

Exception in thread django-main-thread:
Traceback (most recent call last):
  File "E:\Python36\lib\site-packages\django\template\utils.py", line 66, in __getitem__
    return self._engines[alias]
KeyError: 'django'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\Python36\lib\threading.py", line 916, in _bootstrap_inner
    self.run()
  File "E:\Python36\lib\threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "E:\Python36\lib\site-packages\django\utils\autoreload.py", line 54, in wrapper
    fn(*args, **kwargs)
  File "E:\Python36\lib\site-packages\django\core\management\commands\runserver.py", line 117, in inner_run
    self.check(display_num_errors=True)
  File "E:\Python36\lib\site-packages\django\core\management\base.py", line 390, in check
    include_deployment_checks=include_deployment_checks,
  File "E:\Python36\lib\site-packages\django\core\management\base.py", line 377, in _run_checks
    return checks.run_checks(**kwargs)
  File "E:\Python36\lib\site-packages\django\core\checks\registry.py", line 72, in run_checks
    new_errors = check(app_configs=app_configs)
  File "E:\Python36\lib\site-packages\django\contrib\admin\checks.py", line 79, in check_dependencies
    for engine in engines.all():
  File "E:\Python36\lib\site-packages\django\template\utils.py", line 90, in all
    return [self[alias] for alias in self]
  File "E:\Python36\lib\site-packages\django\template\utils.py", line 90, in <listcomp>
    return [self[alias] for alias in self]
  File "E:\Python36\lib\site-packages\django\template\utils.py", line 81, in __getitem__
    engine = engine_cls(params)
  File "E:\Python36\lib\site-packages\django\template\backends\django.py", line 25, in __init__
    options['libraries'] = self.get_templatetag_libraries(libraries)
  File "E:\Python36\lib\site-packages\django\template\backends\django.py", line 43, in get_templatetag_libraries
    libraries = get_installed_libraries()
  File "E:\Python36\lib\site-packages\django\template\backends\django.py", line 108, in get_installed_libraries
    for name in get_package_libraries(pkg):
  File "E:\Python36\lib\site-packages\django\template\backends\django.py", line 121, in get_package_libraries
    module = import_module(entry[1])
  File "E:\Python36\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "E:\Python36\lib\site-packages\rest_framework\templatetags\rest_framework.py", line 12, in <module>
    from rest_framework.renderers import HTMLFormRenderer
  File "E:\Python36\lib\site-packages\rest_framework\renderers.py", line 19, in <module>
    from django.test.client import encode_multipart
  File "E:\Python36\lib\site-packages\django\test\client.py", line 23, in <module>
    from django.test import signals
  File "<frozen importlib._bootstrap>", line 968, in _find_and_load
  File "<frozen importlib._bootstrap>", line 149, in __enter__
  File "<frozen importlib._bootstrap>", line 94, in acquire
_frozen_importlib._DeadlockError: deadlock detected by _ModuleLock('django.test.signals') at 92522872

Traceback (most recent call last):
  File "manage.py", line 21, in <module>
    main()
  File "manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "E:\Python36\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "E:\Python36\lib\site-packages\django\core\management\__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "E:\Python36\lib\site-packages\django\core\management\base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "E:\Python36\lib\site-packages\django\core\management\commands\runserver.py", line 60, in execute
    super().execute(*args, **options)
  File "E:\Python36\lib\site-packages\django\core\management\base.py", line 364, in execute
    output = self.handle(*args, **options)
  File "E:\Python36\lib\site-packages\django\core\management\commands\runserver.py", line 95, in handle
    self.run(**options)
  File "E:\Python36\lib\site-packages\django\core\management\commands\runserver.py", line 102, in run
    autoreload.run_with_reloader(self.inner_run, **options)
  File "E:\Python36\lib\site-packages\django\utils\autoreload.py", line 598, in run_with_reloader
    start_django(reloader, main_func, *args, **kwargs)
  File "E:\Python36\lib\site-packages\django\utils\autoreload.py", line 583, in start_django
    reloader.run(django_main_thread)
  File "E:\Python36\lib\site-packages\django\utils\autoreload.py", line 301, in run
    self.run_loop()
  File "E:\Python36\lib\site-packages\django\utils\autoreload.py", line 307, in run_loop
    next(ticker)
  File "E:\Python36\lib\site-packages\django\utils\autoreload.py", line 347, in tick
    for filepath, mtime in self.snapshot_files():
  File "E:\Python36\lib\site-packages\django\utils\autoreload.py", line 363, in snapshot_files
    for file in self.watched_files():
  File "E:\Python36\lib\site-packages\django\utils\autoreload.py", line 262, in watched_files
    yield from iter_all_python_module_files()
  File "E:\Python36\lib\site-packages\django\utils\autoreload.py", line 103, in iter_all_python_module_files
    return iter_modules_and_files(modules, frozenset(_error_files))
  File "E:\Python36\lib\site-packages\django\utils\autoreload.py", line 139, in iter_modules_and_files
    if not path.exists():
  File "E:\Python36\lib\pathlib.py", line 1336, in exists
    self.stat()
  File "E:\Python36\lib\pathlib.py", line 1158, in stat
    return self._accessor.stat(self)
  File "E:\Python36\lib\pathlib.py", line 387, in wrapped
    return strfunc(str(pathobj), *args)
OSError: [WinError 123] Nazwa pliku, nazwa katalogu lub składnia etykiety woluminu jest niepoprawna: '<frozen importlib._bootstrap>'

comment:2 by Mariusz Felisiak, 5 years ago

Component: MigrationsUtilities
Resolution: duplicate
Status: newclosed
Summary: WindowsError: [Error 123] The filename, directory name, or volume label syntax is incorrect: '<frozen importlib._bootstrap>'WindowsError: [Error 123] The filename, directory name, or volume label syntax is incorrect.

Duplicate of #30352.

comment:3 by Mariusz Felisiak, 5 years ago

Summary: WindowsError: [Error 123] The filename, directory name, or volume label syntax is incorrect._DeadlockError is raised when using StatReloader.

comment:4 by Man Python, 5 years ago

I deleted all _pycache_ dirs with files .pyc and first time runserver was ok, after ctr+c and next try the error back.

Note: See TracTickets for help on using tickets.
Back to Top