Path: csiph.com!x330-a1.tempe.blueboxinc.net!aioe.org!feeder.news-service.com!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.013 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'subject:Problem': 0.09; 'valueerror:': 0.09; 'pm,': 0.11; '25,': 0.12; 'wrote:': 0.14; 'installs': 0.16; 'subject:split': 0.16; 'unpack': 0.16; 'argument': 0.16; 'traceback': 0.16; '(most': 0.16; 'cc:2**0': 0.20; 'cheers,': 0.20; 'header:In-Reply-To:1': 0.22; 'cc:addr :python-list': 0.22; 'mon,': 0.22; 'last):': 0.23; 'value.': 0.25; 'script': 0.26; 'received:209.85.161.46': 0.26; 'received:mail- fx0-f46.google.com': 0.26; 'message-id:@mail.gmail.com': 0.28; "doesn't": 0.28; 'received:209.85.161': 0.29; 'string': 0.29; 'subject:?': 0.29; 'fine.': 0.29; 'cc:addr:python.org': 0.31; 'fails.': 0.31; 'second': 0.31; 'all,': 0.31; 'skip:e 20': 0.33; 'several': 0.33; 'using': 0.34; 'skip:" 10': 0.34; 'there': 0.35; 'characters': 0.35; 'finding': 0.35; 'point': 0.35; 'fails': 0.35; 'wright': 0.35; 'hello,': 0.36; 'getting': 0.36; 'some': 0.37; 'should': 0.37; 'received:209.85': 0.37; 'subject:with': 0.37; 'resulting': 0.38; 'sequence': 0.38; 'skip:\xa0 30': 0.38; 'received:google.com': 0.38; 'but': 0.38; 'though,': 0.39; 'received:209': 0.39; '8bit%:8': 0.39; 'works': 0.40; 'header:Received:5': 0.40; '2011': 0.62; '12:10': 0.84; 'subject:Package': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type:content-transfer-encoding; bh=jPV7Ql/0bl88joxwQZGnRXcon/KYpOWGCCHREROtyTw=; b=vNwirhLmwpCsDBAGAjR4Mw6pS3MVDdhCehbwLfIO2VP5+AHcJeGiUWNMANcZBNKaXi MCJEnJTU8c+Amwd9MD2lPqjL7ugGPIO7wcZD9WsBWbsJmIGG4wcyL2gomaaLyVkl/Ihu d+6+STWM7Ci9d1A40Kf05vKJo9W4TS4prQsuk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=VzxQTgC+cnrZGx1CcX6275Li0ruyiCh22/nfQvJFq0tZRQ3fQ2Kcqk8NVoDZJ+ngAy 71MXX2wSNc7+vWCoMohZh9flHEbglmB0PkooXKQ0pCG+UFh5qQEOw37kbuRrPSf6ns7d NsyIogZHRnWbdiYqwY4NLip22+x2/Pu9P6PEw= MIME-Version: 1.0 In-Reply-To: References: From: Ian Kelly Date: Mon, 9 May 2011 12:41:58 -0600 Subject: Re: Inconsistency with split() - Script, OS, or Package Problem? To: James Wright Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Python X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 22 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1304966550 news.xs4all.nl 81484 [::ffff:82.94.164.166]:55184 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:5004 On Mon, May 9, 2011 at 12:10 PM, James Wright wrote: > Hello, > > I have been using a script on several boxes that have been around for > a while, and everything works just fine. =A0I am finding though, that on > some new OS installs the script fails with: > > Traceback (most recent call last): > =A0File "render4.py", line 114, in > =A0 =A0create_report_index(each_item) > =A0File "render4.py", line 25, in create_report_index > =A0 =A0[clean_name, _] =3D each_value.split('_', 1) > ValueError: need more than 1 value to unpack You should check the value of each_value at the point when the script fails. It sounds like split() is getting passed a string that doesn't contain any '_' characters at all, resulting in a sequence with only one value. Passing 1 as the second argument ensures that there will be at most 1 split, but there may still be fewer. Cheers, Ian