0

I use Google Drive Desktop for Windows 10 and rclone connected to Google Drive for Linux. I would like to have a folder containing Python scripts to use on whichever system I happen to be on.

On Windows, I can type into cmd.exe "(script) arg1 arg2 ..." and it will run.

On Linux, I am using python virtualenv, so I add a shebang to line 1 pointing to the environment I want to use. Something like #!/home/(username)/venv1/bin/python. Then from bash I type "./(script).py arg1 arg2 ..." and it runs fine.

After adding the shebang, when attempting to run the file on Windows again, it fails with an error "windows Unable to create process using /home/(username)/venv1/bin/python".

Some of my google fu search results say "WiNdOwS dOeSnT sUpPoRt sHeBaNgS" but it clearly is having an effect on running my script (Win 10 x64 Python 3.10). Other search results say something like "use /usr/bin/env (python version) and it will all work out".

Does anyone know the proper way to do this? I think the problem with the second solution for me is that I am using a virtualenv, not a system version of python.

JBH
  • 1
  • 1
  • Take a look at this: https://docs.python.org/3/using/windows.html#shebang-lines , you can add "/home/(username)/venv1/bin/python=C:\path to\python.exe" under [Commands] in the .ini file as described there. Found this via https://stackoverflow.com/questions/7574453/shebang-notation-python-scripts-on-windows-and-linux#12716560 – NeatNit Feb 27 '23 at 11:36
  • Not posting it as a proper answer since I didn't try it myself, let me know if it works :) – NeatNit Feb 27 '23 at 11:37

0 Answers0