Running python from cygwin with .py-extension --- import: not found

Olav OlavB at yahoo.com
Thu Sep 7 17:14:58 CEST 2000


Calvelo Daniel wrote:

>
> It seems that your script is not interpreted by Python. Those are not
> Python errors.

No, the script is interpreted.  The problem is  importing  the
libraries:

/home/olav> cat hello.py
print "Hello world"
/home/olav> hello.py
Can't find file Hello world
/home/olav> cat hello2.py
import os
print "Hello world"
/home/olav> hello2.py
import: not found
Can't find file Hello world
/home/olav> python hello2.py
Hello world
/home/olav>

(....That it is trying to look for the file-name instead of printing is
also interesting.....)


>
> I tried to use a script with a '#!/usr/bin/env python' first line
> and it works exactly as in UNIX, ie call it directly after a 'chmod
> +x'.

I am uing PATHEXT=.COM;.EXE;.BAT;.CMD;.ph
(in the NT environment this variable is in fact not visible in cygwin)

.....Though perhaps I should look into the "#"-way of doing it?


Merci!
Olav

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20000907/efaff57c/attachment.html>


More information about the Python-list mailing list