[Tutor] newbie problems with running scripts

Richard Chamberlain richard_chamberlain@ntlworld.com
Sun, 20 Aug 2000 09:11:13 +0100


Sorry that should have read

shouldn't import with the extension or

should import without the extension

take your pick

Richard

Richard Chamberlain wrote:
> 
> 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.
> 
> sys.path.append('c:\\location\\to\\your\\file')
> 
> should enable you to type just:
> 
> import myfile
> 
> Richard
> 
> 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
> 
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://www.python.org/mailman/listinfo/tutor