Newbee question about running a script

Discussion in 'Python' started by marc.assin, Jan 6, 2013.

  1. marc.assin

    marc.assin Guest

    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 ?
     
    marc.assin, Jan 6, 2013
    #1
    1. Advertising

  2. marc.assin

    Miki Tebeka Guest

    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'])
     
    Miki Tebeka, Jan 6, 2013
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. vbGansta
    Replies:
    0
    Views:
    301
    vbGansta
    Feb 16, 2004
  2. Valmir
    Replies:
    3
    Views:
    4,949
    xiko tripa
    Feb 18, 2004
  3. Who

    Newbee question

    Who, Apr 5, 2004, in forum: ASP .Net
    Replies:
    8
    Views:
    478
    Kevin Spencer
    Apr 5, 2004
  4. mbs

    Followup: Newbee Question

    mbs, Apr 6, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    303
    James Hancock
    Apr 6, 2004
  5. EMW
    Replies:
    3
    Views:
    329
    John Timney \(Microsoft MVP\)
    Apr 6, 2004
Loading...

Share This Page