#30500: Error reporting returns a circular import error on a python formatting
error, and does not restart the development server
-------------------------------------+-------------------------------------
Reporter: Runner15 | Owner: (none)
Type: | Status: closed
Cleanup/optimization |
Component: Error reporting | Version: 2.2
Severity: Normal | Resolution: invalid
Keywords: error reporting, | Triage Stage:
error, circular import | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Keryn Knight):
Actually with a bit of effort, I can still reproduce it under 3.5.7 at
least, and I'm suspicious about it being a race
condition/timing(/threading?) problem:
Given:
{{{
import time, os, random
>>> while True:
... time.sleep(random.random())
... os.utime('/path/to/t30500/t30500/views.py')
}}}
after some arbitrary period of leaving `python -b -B manage.py runserver
0:8080` running, I can get it to do it:
{{{
[...]
File "/path/to/t30500/t30500/urls2.py", line 1, in <module>
from . import views
File "/path/to/t30500/t30500/views.py", line 3, in <module>
a
NameError: name 'a' is not defined
/path/to/t30500/t30500/views.py changed, reloading.
Watching for file changes with StatReloader
Performing system checks...
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/path/to/lib/python3.5/site-packages/django/urls/resolvers.py",
line 581, in url_patterns
iter(patterns)
TypeError: 'module' object is not iterable
During handling of the above exception, another exception occurred:
[...]
File "/path/to/lib/python3.5/site-packages/django/core/checks/urls.py",
line 57, in _load_all_namespaces
url_patterns = getattr(resolver, 'url_patterns', [])
File "/path/to/lib/python3.5/site-packages/django/utils/functional.py",
line 80, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/path/to/lib/python3.5/site-packages/django/urls/resolvers.py",
line 588, in url_patterns
raise ImproperlyConfigured(msg.format(name=self.urlconf_name))
django.core.exceptions.ImproperlyConfigured: The included URLconf
't30500.urls' does not appear to have any patterns in it. If you see valid
patterns in the file then the issue is probably caused by a circular
import.
}}}
If it is some form of timing problem, it could be that it has always
existed, but the move to Pathlib has made this specific occurrence more
visible because it's slower, and possibly it's visibility changes between
python versions (I can't say I've tracked if it's been optimised in 3.6+)
for that reason too.
I don't know. None of it is particularly clear cut; these kinds of things
never are.
--
Ticket URL: <https://code.djangoproject.com/ticket/30500#comment:9>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/066.f40d19468249155bc674dd269d859714%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.