3

I'm trying to run my Python scripts via Cygwin from Windows. I'm getting the following error when running Python. The problem is when running Python via Cygwin it then runs the command via the Windows instance of Python i.e. C:\Python32\python.exe which then can't find the py file I'm linking to using the Cygwin way.

$ /cygdrive/c/Python32/python /cygdrive/c/elf/GIT/src/sfgenctl.py
C:\Python32\python.exe: can't open file '/cygdrive/c/elf/GIT/src/sfgenctl.py':
[Errno 2] No such file or directory

Is there a way around this?

Thanks

3 Answers 3

3

Use cygpath to convert it to Windows paths before passing it to python.exe:

/cygdrive/c/Python32/python "`cygpath -w /cygdrive/c/elf/GIT/src/sfgenctl.py`"
Sign up to request clarification or add additional context in comments.

2 Comments

or you could just use windows path to start with ... cygwin understands it ... just doesnt like it much
@Joran: I was assuming that the path was being dynamically generated by some other program. If it really is just a constant, then sure, change it yourself.
1

I solve it by:

  1. Go into the folder where the script is. cd /cygdrive/c/elf/GIT/src/
  2. run python -i sfgenctl.py

Notice the -i flag.

Comments

0

Simple way of doing this was to install the Python Cygwin add on. Thanks for the helo guys.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.