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

shutil run module using sys.executable #148

Open
jayvdb opened this issue Oct 8, 2019 · 2 comments
Open

shutil run module using sys.executable #148

jayvdb opened this issue Oct 8, 2019 · 2 comments

Comments

@jayvdb
Copy link

jayvdb commented Oct 8, 2019

I was surprised that the very common case of "run package module using sys.executable" isnt supported. i.e. [sys.executable, '-m', 'package']

It isnt the same as run_module_as_main, as invoking the real Python executable can be necessary to catch extra problems related to IO setup, esp LANG, PYTHONIOENCODING etc.

It is quite often done incorrectly, e.g. without quotes around sys.executable as I did above, which is usually ok on unix but often fails on Windows.

@jayvdb
Copy link
Author

jayvdb commented Oct 8, 2019

Possibly/probably? want to use get_real_python_executable as part of this, and could also smartly only add the quotes when it is necessary, and leave them out when not beneficial.

@eeaston
Copy link
Collaborator

eeaston commented Nov 19, 2021

Good suggestion - thanks for this. Sorry for the ridiculously long time to reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants