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

David Bolen db3l at fitlinxx.com
Thu Sep 7 19:43:45 EDT 2000


Olav <OlavB at yahoo.com> writes:

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

But the script isn't being interpreted by Python, but by some other
shell.  That's what is giving you those errors.  It's not obvious
which shell just from this output, but if I had to bet I'd say you've
got the NT command interpreter (cmd) trying to treat this as a batch
file.

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

Did you try adding ".py" to the end of PATHEXT?  If that is present,
and you start the program from the NT command interpreter (cmd), then
it should use the standard file association to figure out how to run
the program - e.g., it'll interpret it with Python.

If you are using a Cygwin shell (e.g., bash), then you can actually do
the #! approach just as on Unix instead of using PATHEXT.

--
-- David
-- 
/-----------------------------------------------------------------------\
 \               David Bolen            \   E-mail: db3l at fitlinxx.com  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \
\-----------------------------------------------------------------------/



More information about the Python-list mailing list