#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): Adding details as I figure them out a bit, on the off-chance they prove valuable: instrumented `django/urls/resolvers.py`: {{{ def url_patterns(...): patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) print('url_patterns', type(patterns), patterns) }}} instrumented `django/utils/autoreload.py`: {{{ def run(...): [...] try: v = get_resolver().urlconf_module print('run', type(v), v) [...] }}} Then, running the `utime(...)` script in a while loop as above, with runserver running (and `a` commented out): {{{ url_patterns <class 'list'> [<URLResolver <module 't30500.urls2' from '/path/to/t30500/t30500/urls2.py'> (None:None) ''>] run <class 'module'> <module 't30500.urls' from '/path/to/t30500/t30500/urls.py'> url_patterns <class 'list'> [<URLPattern ''>] }}} The order of those calls changes sometimes (for me), so I guess it's maybe separate threads ''and'' non-deterministic? But importantly, they stay the same types and values, by the look of it. If `a` is uncommented, to raise `NameError: name 'a' is not defined`, every time `NameError` is thrown, the only print is: {{{ run <class 'module'> <module 't30500.urls' from '/path/to/t30500/t30500/urls.py'> Exception in thread django-main-thread: [...] }}} when `ImproperlyConfigured: The included URLconf 't30500.urls' ...` is thrown, the only print is **instead**, this: {{{ url_patterns <class 'module'> <module 't30500.urls' from '/path/to/t30500/t30500/urls.py'> Exception in thread django-main-thread: [...] }}} This seems like an important distinction (to me, with my highly sophisticated print-debugging, as pdb was being little help), and **additionally** the patterns variable is a module, rather than a list. -- Ticket URL: <https://code.djangoproject.com/ticket/30500#comment:12> 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 django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/066.0942c44815a0fc79045f5c9c5429a1b1%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.