Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #41930

problem with sys import argv

From leonardo selmi <l.selmi@icloud.com>
Subject problem with sys import argv
Date 2013-03-26 18:26 +0100
Newsgroups comp.lang.python
Message-ID <mailman.3761.1364318792.2939.python-list@python.org> (permalink)

Show all headers | View raw


hi python community,

i wrote the following programm:

from sys import argv

script, userName = argv
prompt = '> '

print 'hi %s, i am the %s script' % (userName, script)
print "i'd like to ask you a few questions."
print 'do you like me %s' % userName
likes = raw_input(prompt)

print "where do you live %s?" % userName
lives = raw_input(prompt)

print 'what kind of computer do you have?'
computer = raw_input(prompt)

print """
alright so you said %r about liking me.
you live in %r. not sure where that is.
and you have a %r computer. nice
""" % (likes, lives, computer)

and i got the following error:  Traceback (most recent call last):
File "/var/folders/89/84z7tw3d3rv39gny3n2p963m0000gn/T/pythonInTerm.GUF6PWCM", line 3, in <module>
  script, userName = argv
ValueError: need more than 1 value to unpack

what can i do?

thanks!

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

problem with sys import argv leonardo selmi <l.selmi@icloud.com> - 2013-03-26 18:26 +0100

csiph-web