Closed bernardotorres closed 7 years ago
Thank you for your efforts. Maybe your suggestion is not that ugly as you state if we encapsulate it.
try:
except WindowsError: sys.exec_prefix+="\Scripts"
This would minimize possible side effects to the cases necessary.
On 2015-02-09 13:30, Bernardo Torres wrote:
One ugly, but working fix would be running this in the beginning of your |service.py|:
|sys.exec_prefix = sys.exec_prefix + "\Scripts\"|
It seems that the problem in multiprocessing persists even in Python 3.6 (just checked the code, and I also didn't find a bug for it), so I now added the proposed workaround to service.py. @bernardotorres - if this is still an issue for you, you may check if this solves the problem - I currently don't have an environment to really test this.
Shall be fixed with version 0.2.
My environment: Windows 7 Python 2.7 django-windows-tools from git (updated today)
The service wasn't starting, so I tried running as:
$ python service.py debug
And the following error was issued:
WindowsError: (2, 'The system cannot find the file specified')
Debugging a little further, I found that the python interpreter was being wrongly found as
%VIRTUALENV_PATH%\python.exe
, without the\Scripts\
in the path. For example, if the Virtualenv was inC:\MyVirtualenv\
, it assumed the interpreter was inC:\MyVirtualenv\python.exe
and notC:\MyVirtualenv\Scripts\python.exe
. Therefore it could not run the service.Searching the web, I found that it is a known problem, but currently not fixed. If assumes python path is
sys.exec_prefix
, when that is not always the case:https://hg.python.org/cpython/file/e55f955659bc/Lib/multiprocessing/forking.py
Virtualenv people have claimed no responsibility about it:
https://github.com/pypa/virtualenv/issues/467
One ugly, but working fix would be running this in the beginning of your
service.py
:sys.exec_prefix = sys.exec_prefix + "\\Scripts\\"