[Tutor] newbie problems with running scripts

Richard Chamberlain richard_chamberlain@ntlworld.com
Sun, 20 Aug 2000 08:56:01 +0100

Hi Andre,

Firstly you should import with the extension so it should be:

import myfile

Secondly you might find that python cannot find your file. The reason is
that python looks in certain directories. There are two ways for you to
get round this. The easiest way for you is to use import on one of the
pythonwin menus. The other way is to do this at the interactive shell:

import sys
print sys.path

That should give you a list of locations python is looking in.


should enable you to type just:

import myfile


Andre Quintos wrote:
> Hi.
> I biought this book from O'reilly called Learning Python and am following
> all their excercises. So I went to the python.org site and downloaded
> everything I needed (I use a Win2K system).
> I have installed the python 1.5.2 and pythonwin. I use these programs with
> the excercises in the book.
> While in pythonwin, I create the file called myfile.py which contains the
> following:
> title = "The Meaning of Life"
> The book then tells me to do this:
> >>>import myfile.py
> >>>print myfile.title
> When I do the first statement I get this error in pythonwin:
> Traceback (innermost last):
>   File "<interactive input>", line 1, in ?
> ImportError: No module named py
> What could be the problem here? Is it a problem with the installation of the
> programs or the problem with the code? Or is there something I should do to
> make python and pythonwin work properly in win2k?
> Thanks for the help (in advance)
> Andre
> those who believe in free will make the best puppets of all.
>  -- Lucifer #3
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://www.python.org/mailman/listinfo/tutor