Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Newbee question about running a script

Reply
Thread Tools

Newbee question about running a script

 
 
marc.assin
Guest
Posts: n/a
 
      01-06-2013
Hello,

I've just installed Python 2.7 on Windows 7
I've been able to write and run a script "Hello world"
I wonder how I could specify a parameter on the command line from
within the interpreter.
Specifying a parameter on the DOS command line is no problem.

Any hint, please ?


 
Reply With Quote
 
 
 
 
Miki Tebeka
Guest
Posts: n/a
 
      01-06-2013
On Sunday, January 6, 2013 8:03:43 AM UTC-8, marc.assin wrote:
> I wonder how I could specify a parameter on the command line from
> within the interpreter.

Guido wrote some advice a while back - http://www.artima.com/weblogs/viewpost.jsp?thread=4829

Import your module and call its main.

The other way is to execute in another process:
from subprocess import check_call
import sys
check_call([sys.executable, 'myscript.py', 'arg1', 'arg2'])
 
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
total newbee question Jim ODonnell Firefox 11 12-25-2004 08:24 AM
Newbee question Who ASP .Net 8 04-05-2004 07:34 PM
Newbee question: How to kill a cookie? Valmir ASP .Net 3 02-18-2004 12:58 PM
NewBee Type Question about displaying text vbGansta ASP .Net 0 02-16-2004 06:36 PM
Newbee question: Adrian Cisco 3 11-29-2003 01:46 PM



Advertisments