[Tutor] How to run a script file

Patric Michael patric at usa.net
Tue Jan 4 23:55:54 CET 2005


Hi Bernard...

The most basic form is to type "python" followed by the script you want 
to run.  If your script is not in the system path, you'll either need to cd to 
the directory, or give a full pathname: (the pythonpath doesn't come into 
play until the interperter is running.

python /usr/local/share/filename.py

Remember that the script will inherit whatever permissions you currently 
have, so either log in or su to the user that's expected to run the script.

Oh, and in case python itself isnt in your system path, (it probably is)  
you can find it by typing "which python" at the shell prompt.


Patric



> Hi,
> 
> Sorry if I missed something obvious, but how do I execute a python
> script file in the interpreter? I have "Using the Python Interpreter"
> in the Python tutorial but not much is said...
> 
> (this might be a lame quesiton but so far I always used either the
> PythonWin interpreter wich has the Import function, or I ran Python
> code in an application. Now I'm on Linux so I have to learn the hard
> way!)
> 
> 
> Thanks
> Bernard
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
> 




More information about the Tutor mailing list