Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using virtualenv in windows service,cannot find the correct python.exe path #467

Closed
stevendai opened this issue Aug 30, 2013 · 3 comments
Closed

Comments

@stevendai
Copy link

PYTHON 2.7

using virtualenv in windows service,cannot find the correct python.exe path,
in multiprocessing/forking.py file there is code(line 217):
if WINSERVICE:
_python_exe = os.path.join(sys.exec_prefix, 'python.exe')
this path not find python.exe ,because in virtualenv the python.exe file is at
os.path.join(sys.exec_prefix, 'Scripts','python.exe')

@pnasrat
Copy link

pnasrat commented Aug 30, 2013

This strikes me as more likely an issue with multiprocessing/forking.py @pfmoore any opinions on the right way to get the path to the python.exe

@pfmoore
Copy link
Member

pfmoore commented Aug 30, 2013

Agreed. This is a bug in multiprocessing/forking.py. Note that the docs for sys.exec_prefix don't say that python.exe is always located in that directory (and that's what isn't true for a virtualenv).

Actually, as Python doesn't come with a pythonservice.exe (that's in pywin32) this is the standard library trying to support running via a 3rd party package (and getting it wrong when a virtualenv is involved). It's hard to know how best to address this. But it's not our problem (as a data point, a Python 3.3 venv would have the same issue).

You could look for sys.prefix/python.exe and sys.prefix/Scripts/python.exe and use whichever exists. That's a bit of a hack, but it's the best I can suggest without knowing more about how pywin32 works.

@stale
Copy link

stale bot commented Jan 15, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Just add a comment if you want to keep it open. Thank you for your contributions.

@stale stale bot added the wontfix label Jan 15, 2019
@stale stale bot closed this as completed Jan 22, 2019
@pypa pypa locked and limited conversation to collaborators Jan 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants