Cygwin: To use Windows Python in shebang

Create a bash script as a proxy:

Filename wpython save it some where in your $PATH

#!/bin/bash
path=$1  
# remove the first argument
shift  
python.exe $(cygpath -w $path) [email protected]  

Now, we can use this shebang:

#! /usr/bin/env wpython

The code will convert Cygwin path back to Windows path, and thus compatible with Windows Python.

Konpat Preechakul

Read more posts by this author.