#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2011
    Location
    Sydney, Australia
    Posts
    63
    Rep Power
    4

    Python passing variables to argv


    I'm reading "learn python the hard way", doing exercise 13, it says "Run the program like this(and you must pass 3 command line arguments): python ex13.py first 2nd 3rd"

    So, I guess you type that into the python command line program? So I do that, but I get it saying that ex13 is invalid syntax. Halp please? ty...

    I'm running on windows 7 btw
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2011
    Location
    Sydney, Australia
    Posts
    63
    Rep Power
    4
    I've never used command line to run .py file before I usually run from the IDE
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2011
    Location
    Sydney, Australia
    Posts
    63
    Rep Power
    4
    I also get an invalid syntax error when I try to do that through the python shell.

    Edit: I did some reading on the googles and I tried using sys.argv = [], but I get this error: ValueError: need more than 1 value to unpack
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2012
    Location
    USA
    Posts
    1
    Rep Power
    0
    I've never used command line to run .py file before I usually run from the IDE

    aitken325i mod edit - url removed. Please read the FAQ's
    Last edited by aitken325i; April 9th, 2012 at 03:37 PM.

IMN logo majestic logo threadwatch logo seochat tools logo