I'm running the code below in Spyder. I have typed it in a py file and simply hit the run button.
When I try to run it I get the error:
ValueError: need more than 1 value to unpack
As shown here you are meant to give the inputs for the argv variable before running the program but I don't know how to do this is spyder?
http://learnpythonthehardway.org/book/ex13.html
from sys import argv script, first, second, third = argv print "The script is called:", script print "The first variable is:", first print "The second variable is:", second print "Your third variable is:", third
To run a script in Spyder IDE, there are two options: use the command line option, use runfile in IPython.
The key to run the current line by itself is F9 . The shortcut ctrl+F10 is used if you are in debugging mode.
To schedule a Python script with Task scheduler, create an action and add the path to your Python executable file, add the path to the script in the “Start in” box and add the name of the Python file ase an argument. Then, create a trigger to schedule the execution of your script.
To pass argv
to a script in Spyder, you need to go the menu entry
Run > Configuration per file
or press the Ctrl+F6 key, then look for the option called
Command line options
on the dialog that appears after that, and finally enter the command line arguments you want to pass to the script, which in this case could be
one two three
In addition to configuring in the Run->Configure
as explained in other answers, you can use "runfile" directly from the console.
Run the following:
runfile('ex13.py', args='first second third')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With