Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > How to run Python file?

Reply
Thread Tools

How to run Python file?

 
 
mistral
Guest
Posts: n/a
 
      09-02-2006
I have installed ActivePython
http://www.activestate.com/Products/ActivePython/
How I can run Python file, test.py?

 
Reply With Quote
 
 
 
 
Pontus Ekberg
Guest
Posts: n/a
 
      09-02-2006
mistral wrote:

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


$ python test.py

or

$ ./test.py (if test.py is executable)


 
Reply With Quote
 
 
 
 
zefciu
Guest
Posts: n/a
 
      09-02-2006
Pontus Ekberg wrote:
> mistral wrote:
>
>> I have installed ActivePython
>> http://www.activestate.com/Products/ActivePython/
>> How I can run Python file, test.py?

>
> $ 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
 
Reply With Quote
 
Ant
Guest
Posts: n/a
 
      09-02-2006

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:

> test.py


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

 
Reply With Quote
 
Rick Zantow
Guest
Posts: n/a
 
      09-02-2006
"Ant" <(E-Mail Removed)> wrote in news:1157218244.750434.36220
@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:
>
>> test.py

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


As would:

> test


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

--
rzed
 
Reply With Quote
 
mistral
Guest
Posts: n/a
 
      09-02-2006

Rick Zantow писал(а):

> "Ant" <(E-Mail Removed)> wrote in news:1157218244.750434.36220
> @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:
>
>> test.py

>
> Assuming python grabbed the .py extensions correctly (which it

shouold
> have done with any recent version).
>
>


> As would:


> test


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

> --
> rzed


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

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?

 
Reply With Quote
 
Rick Zantow
Guest
Posts: n/a
 
      09-03-2006
"mistral" <(E-Mail Removed)> wrote in news:1157239512.139823.15650
@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.

--
rzed

 
Reply With Quote
 
Dennis Lee Bieber
Guest
Posts: n/a
 
      09-03-2006
On 2 Sep 2006 16:25:12 -0700, "mistral" <(E-Mail Removed)>
declaimed the following in comp.lang.python:


>
> 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"
>test.py


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
http://www.velocityreviews.com/forums/(E-Mail Removed) (E-Mail Removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (E-Mail Removed))
HTTP://www.bestiaria.com/
 
Reply With Quote
 
Jason
Guest
Posts: n/a
 
      09-03-2006
mistral wrote:
> 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

 
Reply With Quote
 
Steve Holden
Guest
Posts: n/a
 
      09-03-2006
mistral wrote:
> I have installed ActivePython
> http://www.activestate.com/Products/ActivePython/
> How I can run Python file, test.py?
>

Sheesh, you must have had ten replies and nobody bothered to point you
to the frequently-asked questions ... kids today!

http://www.python.org/doc/faq/windows.html

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Run a python script as an exe and run a new process from it venutaurus539@gmail.com Python 9 02-27-2009 05:22 PM
EMBEDDING > Run Python & Run C Function anonymisiert85@mymail.ch Python 3 06-23-2007 04:15 AM
Can't Run 'RUN' Windows XP Home Luke O'Malley Computer Support 2 09-01-2005 11:38 PM
can run javascript can't run vbscript - WHY duncan ASP .Net 2 10-27-2004 09:31 AM



Advertisments