How to run Python file?

Z

zefciu

Pontus said:
$ python test.py

or

$ ./test.py (if test.py is executable)
Thats if you use un*x. If you word under windows, the first would work,
but rather use some IDE like IDLE or SPE than mess with the windows
command line. Then you just load the file and run it from the menu.

zefciu
 
A

Ant

zefciu said:
Pontus Ekberg wrote: ....
Thats if you use un*x. If you word under windows, the first would work,

As would:

Assuming python grabbed the .py extensions correctly (which it shouold
have done with any recent version).
 
R

Rick Zantow

work,

As would:


Assuming python grabbed the .py extensions correctly (which it shouold
have done with any recent version).

As would:

.... assuming you're on windows (Win2K or WinXP at least) and you've
added ".py" to your PATHEXT environment variable.
 
M

mistral

Rick Zantow пиÑал(а):
@h48g2000cwc.googlegroups.com:

zefciu wrote:
Pontus Ekberg wrote:
...
> $ python test.py
>
> or
>
> $ ./test.py (if test.py is executable)
>
>
Thats if you use un*x. If you word under windows, the first would work,
>
> As would:
>
>
> Assuming python grabbed the .py extensions correctly (which it shouold
> have done with any recent version).
>
>
As would:

... assuming you're on windows (Win2K or WinXP at least) and you've
added ".py" to your PATHEXT environment variable.

-------------

Assuming I have Windows XP, and I installed ActiveState Python. No any
other additional manipulations were done, no any PATHEXTes environment
variables, etc, etc, nothing. How many preparatory work required to run
one small python file?
 
R

Rick Zantow

@74g2000cwt.googlegroups.com:

[...]
Assuming I have Windows XP, and I installed ActiveState Python. No any
other additional manipulations were done, no any PATHEXTes environment
variables, etc, etc, nothing. How many preparatory work required to run
one small python file?

I hope I'm understanding your question correctly.

I can't really answer with regard to ActiveState's version. I've only
used the Python.org binary installation for a long time, and it does set
up the path on installation. I don't think it adds the PATHEXT, but I
really don't remember; I've had some version on my computer since Python
1.5.2. Without that, though, all you'd need would be to type
python test.py
.... given the other assumptions you've indicated. Oh, if you are running
the python program (located in a directory not in your path) from some
other directory, you'd need to specify the full pathname, I suppose,
like
python c:\dir\test.py

I'd assume that ActiveState also sets the path up, but again, I can't
say for sure that it does. If it doesn't, then you'd add the Python root
directory to your path or else you'd have to specify *that* each time as
well.
 
D

Dennis Lee Bieber

Assuming I have Windows XP, and I installed ActiveState Python. No any
other additional manipulations were done, no any PATHEXTes environment
variables, etc, etc, nothing. How many preparatory work required to run
one small python file?

How small a file?

(watch out for line wraps)

C:\Documents and Settings\Dennis Lee Bieber>echo print "hello world"

C:\Documents and Settings\Dennis Lee Bieber>test
hello world

C:\Documents and Settings\Dennis Lee Bieber>

C:\Documents and Settings\Dennis Lee Bieber>python -V
Python 2.4.3

C:\Documents and Settings\Dennis Lee Bieber>python
ActivePython 2.4.3 Build 12 (ActiveState Software Inc.) based on
Python 2.4.3 (#69, Apr 11 2006, 15:32:42) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
--
Wulfraed Dennis Lee Bieber KD6MOG
(e-mail address removed) (e-mail address removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (e-mail address removed))
HTTP://www.bestiaria.com/
 
J

Jason

mistral said:
I have installed ActivePython
http://www.activestate.com/Products/ActivePython/
How I can run Python file, test.py?

You can open up the folder containing the "test.py" file, then
double-click on the file to run it. A command-line window should pop
up, and your program will run in it. Once the Python program is done
running, the command window will probably close immediately.

--Jason
 
B

bearophileHUGS

mistral:
I have installed ActivePython
http://www.activestate.com/Products/ActivePython/
How I can run Python file, test.py?

Running Python scripts is easy. Load the test.py from the ActivePython
and run it.
Otherwise you can just click on the file, otherwise you can open a
shell in the dir where your py file is, and you can enter its name (so
you can see its textual output). Tell us what happens and
errors/problems you have.

Bye,
bearophile
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top