En Fri, 16 Mar 2007 19:59:09 -0300, Anil Kumar <[EMAIL PROTECTED]>  
escribió:

> 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?

C:\TEMP>type test.sh
print "Hello!"

C:\TEMP>python test.sh
Hello!

For a *script* that you run explicitely, Python doesn't care of the  
extension. But a *module* (used with the import statement) must be a  
.py/.pyc/.pyo
Also, if you run the script with: python scriptname.sh, it's ok; but if  
you run it just using: scriptname.sh, won't work; Windows uses the file  
extension to determine the program to run, instead of the !# line.

> 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.

I assume you're not using Cygwin - you can create a stub version of each  
script, so that foo.sh contains: python foo.py, and associate .sh  
extension with cmd.exe

-- 
Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to