Re: [Tutor] Help this newbie

2008-03-21 Thread Alan Gauld

Elliot Silvers [EMAIL PROTECTED] wrote

 I am as new as you can get to Python. I have just learned 
 how to save my work (very simple work of course). 
 I created a folder on C:\ (in this case C:\Elliot) for my work. 
 I am able to use the cmd prompt to run it 

Congratulations. You should also be able to run it by 
double clicking in explorer.

 however I cannot figure out how to import it using the 
 python (command line). 

Can you show us what happens when you try.
Cut n paste from the command window into your email.

However there are two areas which might be messing things up:
1) do not specify the .py when importing
ie to import foo.py type import foo
2) Make sure your Elliot folder is in the import path. 
There are several waays to do this, the simplest is to add
your folder to the PYTHONPATH environment variable.

(If 2 is the problem then the impoprt should work OK if 
you CD to your folder before starting Python...)

To set environment variables see the sidebar in the 
Moresequences topic in my tutorial... You will probably 
need to create PYTHONPATH as a new variable.

HTH,


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help this newbie

2008-03-20 Thread tiger12506
This is Windows I presume?

Try:

cd\python25
python C:\Elliot\filename.py

But for windows you shouldn't have to. You can just double-click the file.
On the other hand, if you mean 'import' as it means in the context of the 
actual python language, then you would put the line import filename at the 
top of a script which is supposed to use your module.




- Original Message - 
From: Elliot Silvers
To: tutor@python.org
Sent: Thursday, March 20, 2008 9:21 PM
Subject: [Tutor] Help this newbie


I am as new as you can get to Python. I have just learned how to save my 
work (very simple work of course). I created a folder on C:\ (in this case 
C:\Elliot) for my work. I am able to use the cmd prompt to run it (cd 
\Elliot - C:\Elliot 'filename.py') however I cannot figure out how to 
import it using the python (command line).
Please help. There is most likely a very simple solution. I have just not 
been able to figure it out.
Thanks
Elliot



Windows Live Hotmail is giving away Zunes. Enter for your chance to win.



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor 
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor