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


Groups > comp.lang.python > #41930

problem with sys import argv

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <l.selmi@icloud.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; '"""': 0.07; 'error:': 0.07; 'sys': 0.07; 'valueerror:': 0.09; 'sfxlen:2': 0.11; 'python': 0.11; 'wrote': 0.14; '"i\'d': 0.16; '%r.': 0.16; "%s'": 0.16; '%s,': 0.16; 'script,': 0.16; 'skip:" 70': 0.16; 'subject:import': 0.16; 'unpack': 0.16; 'community,': 0.19; 'import': 0.22; 'to:name:python-list@python.org': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'subject:problem': 0.24; 'cc:2**0': 0.24; 'username': 0.31; 'file': 0.32; 'thanks!': 0.32; '(most': 0.33; 'computer.': 0.33; 'subject:with': 0.35; 'charset:us-ascii': 0.36; 'received:17': 0.38; 'to:addr:python- list': 0.38; 'recent': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'is.': 0.60; 'kind': 0.63; 'more': 0.64; 'prompt': 0.68; 'lives': 0.74; 'liking': 0.84
X-Proofpoint-Virus-Version vendor=fsecure engine=2.50.10432:5.10.8626,1.0.431,0.0.0000 definitions=2013-03-26_04:2013-03-26, 2013-03-26, 1970-01-01 signatures=0
X-Proofpoint-Spam-Details rule=notspam policy=default score=0 spamscore=0 ipscore=0 suspectscore=3 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=6.0.2-1302030000 definitions=main-1303260167
From leonardo selmi <l.selmi@icloud.com>
Content-type text/plain; charset=us-ascii
Content-transfer-encoding quoted-printable
Subject problem with sys import argv
Date Tue, 26 Mar 2013 18:26:00 +0100
To "python-list@python.org" <python-list@python.org>
MIME-version 1.0 (Mac OS X Mail 6.2 \(1499\))
X-Mailer Apple Mail (2.1499)
Cc "help@python.org" <help@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3761.1364318792.2939.python-list@python.org> (permalink)
Lines 36
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1364318792 news.xs4all.nl 6850 [2001:888:2000:d::a6]:40727
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:41930

Show key headers only | 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