File extension

Anil Kumar at
Fri Mar 16 23:59:09 CET 2007


Can Python Script can have different extensions like .sh etc.... Or Is .py
is mandatory to be present as the extension for the Python Script.

We have an application where the script was initially written in shell
script with extension .sh. Now we are migrating this script to be run in
both Unix and Windows, so using Python for migration.

I have created a new Python Script porting all the changes in shell script
and it is working fine in Unix/Linux operating system. Later I changed the
extension of the file from .py to .sh, even then it worked.

But when I try a python script with extension .sh in windows, the file is
not getting recognized by the Python interpreter. Is this supported? Or is
there any way we can achieve the same?

The reason I am trying to change the extension is, it reduces lot of porting
changes. No need to go to each of our file which were referencing .sh file
before and change it to .py.

Any Help would be greatly Appreciated.

Thanks & Regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list