Skip to content

Change path to python for Windows os#63

Open
tarasfrompir wants to merge 1 commit into
coqui-ai:mainfrom
tarasfrompir:patch-1
Open

Change path to python for Windows os#63
tarasfrompir wants to merge 1 commit into
coqui-ai:mainfrom
tarasfrompir:patch-1

Conversation

@tarasfrompir

Copy link
Copy Markdown

No description provided.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@erogol

erogol commented Aug 26, 2022

Copy link
Copy Markdown
Member

Hey thanks for the PR but why do we assume python for win32?

@tarasfrompir

Copy link
Copy Markdown
Author

Because it is written in the sys module documentation -
Windows | 'win32'

https://docs.python.org/3/library/sys.html

@erogol

erogol commented Oct 19, 2023

Copy link
Copy Markdown
Member

@tarasfrompir do you mind signing the CLA for me to merge the PR

Comment thread trainer/distribute.py
Comment on lines +55 to +58
if sys.platform == 'win32':
p = subprocess.Popen(["python"] + command, stdout=stdout, env=my_env) # pylint: disable=consider-using-with
else:
p = subprocess.Popen(["python3"] + command, stdout=stdout, env=my_env) # pylint: disable=consider-using-with

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The correct, platform-and-virtualenv-agnostic way to do this is sys.executable.

Suggested change
if sys.platform == 'win32':
p = subprocess.Popen(["python"] + command, stdout=stdout, env=my_env) # pylint: disable=consider-using-with
else:
p = subprocess.Popen(["python3"] + command, stdout=stdout, env=my_env) # pylint: disable=consider-using-with
p = subprocess.Popen([sys.executable, *command], stdout=stdout, env=my_env) # pylint: disable=consider-using-with

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we don't need to run this if it is not Win32.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants