Trying to use "Programming Python" (Lutz), getting module errors.

Tiberius Teng tiberius at ms28.hinet.net
Mon May 6 06:25:50 EDT 2002


robline at purdue.edu (Rob Lineberger) wrote in message news:<84773476.0205052134.8c1d533 at posting.google.com>...
> I'm trying to learn Python, so I picked up Mark Lutz' Programming
> Python.  Using latest builds of Python and Pythonwin.
> 
> print 'Hello world!' worked ok. 
> 
> As soon as I move on to page 13, Running Module Files, it breaks.  I
> opened up notepad and created a file called spam.py.  When I try to
> use it, pythonwin says no such module exists.  I saved it in My
> Documents, but I have no idea how to tell Python to look there.  So I
> saved it to C:\Python22\Lib\spam.py.  No dice.
> 
> Tried using spam.py from the command prompt, IDLE, etc, all to no
> avail.
> 
> Tried setting PYTHONPATH to C:\Python22\Lib but that didn't work
> either.
> 
> I can't learn this language if I can't create and import modules.  Any
> advice?

I would recommand you start learning Python by reading "Learning
Python" (also by Mark Lutz & David Ascher), not "Programming Python"
... :)

However if you put your spam.py in C:\Python22\Lib then typing 'import
spam' inside Pythonwin / IDLE should work ...



More information about the Python-list mailing list