#34787: The 'runserver' command doesn't work when run from an installed script 
on
Windows
-------------------------------------+-------------------------------------
     Reporter:  Joël Larose          |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Core (Management     |                  Version:  4.2
  commands)                          |
     Severity:  Normal               |               Resolution:  needsinfo
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

 * cc: David Smith (added)
 * status:  new => closed
 * has_patch:  1 => 0
 * resolution:   => needsinfo


Comment:

 Replying to [ticket:34787 Joël Larose]:
 > It gives:
 > {{{
 > <project_path>\venv\Scripts\python.exe: Error while finding module
 specification for '__main__' (ValueError: __main__.__spec__ is None)
 > }}}
 >
 > After much debugging and tracing, I found where the issue lies.  The
 problem is in the `get_child_arguments` function in
 `django/utils/autoreload.py`.  When you flip the first two `if`-`elif`
 blocks, everything works.  That is, the check for `not py_script.exists()`
 needs to come before the check for `getattr(__main__, "__spec__", None) is
 not None`.

 Can you provide the full stacktrace? I'm not sure how swapping these
 branches can make a difference as the first one is protected against
 `None` `__spec__`.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34787#comment:1>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018a16215731-b66e34fb-7b53-4b01-8a6c-1e3a403a09ae-000000%40eu-central-1.amazonses.com.

Reply via email to