[Tutor] help with program from learning python the hard way

Walter Prins wprins at gmail.com
Thu Jan 19 14:21:50 CET 2012

Hi Jason,

On 19 January 2012 13:02, Jason Loeve <jasonloeve at gmail.com> wrote:

> good day i seem to be stuck, my code is
> from sys import argv
> script, user_name = argv
> and i get an error ValueError: need more than 1 value to unpack

The implication of this message is that the value of "argv" contains only
one value, which would be true if the script was run with no command line

> http://learnpythonthehardway.org/book/ex14.html
> i am using PyCharm 1.5.4 to run

I'm not familiar with PyCharm but by default IDE's obviously would not be
passing any command line parameters to programs they run.  Most IDE's have
some way of specifying the command line parameters to pass the script, but
I can't tell you how to do this in PyCharm, so if you insist on running
from PyCharm you'll have to find out how to do that on your own.

I however suggest tha you instead use PyCharm purely as an editor, and
follow the instructions in the Excercise which is to run the script from
the command prompt, with the parameters as shown in the excercise.  Then
you should have not have this problem and you should be able to follow what
the book is doing more closely.

Additionally I suggest you go back to the previous section, Excecise 13 on
"Parameters, Unpacking, Variables" since I get the sense from your question
that you may not have completed this section properly or may have glossed
over it, since if you had successfully completed this then you should not
have had the above problem in the first place.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120119/8e079ae2/attachment.html>

More information about the Tutor mailing list