I want to place my Python script into directory listed in PATH and call that script just by typing its name from any location in cygwin on Windows.
I'm using shebang
#!/usr/bin/env python
that works perfect on Linux machine.
Nevertheless by calling the following line from windows cygwin I get an error:
$ my_script.py some arguments
C:\app\Python36\python.exe: can't open file '/cygdrive/d/11_scripts/my_script.py': [Errno 2] No such file or directory
Problem is caused by the fact that cygwin expands the script path and python doesn't understand the cygwin way of mounted drives: /cygwin/d/... When I run the script with the full path (in win format) or by relative path it works.
$ d:/11_scripts/my_script.py some arguments
Do you know about any workaround? Similar issue is discussed here: Problems running Python script via Cygwin But I want to use the PATH.
Thank you!
ADDITION: at the moment I use kind of bash wrapper script that is put into PATH:
#!/usr/bin/bash
pypath='/cygdrive/c/app/Python36/python'
$pypath -u 'd:\11_scripts\my_script.py' $@