Path: csiph.com!x330-a1.tempe.blueboxinc.net!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.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.017 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'kelly': 0.09; '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; 'thanks,': 0.17; 'fine': 0.18; 'input': 0.18; 'cheers,': 0.20; 'header:In-Reply-To:1': 0.22; 'mon,': 0.22; 'last):': 0.23; 'value.': 0.25; 'script': 0.26; 'message-id:@mail.gmail.com': 0.28; "doesn't": 0.28; 'string': 0.29; 'subject:?': 0.29; 'fine.': 0.29; 'seem': 0.30; 'fails.': 0.31; 'second': 0.31; 'does': 0.31; 'all,': 0.31; 'to:addr:python-list': 0.32; 'skip:e 20': 0.33; 'several': 0.33; 'using': 0.34; 'skip:" 10': 0.34; 'file.': 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; 'however': 0.37; 'way.': 0.37; 'should': 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; 'to:addr:python.org': 0.39; '8bit%:8': 0.39; 'works': 0.40; 'header:Received:5': 0.40; '2011': 0.62; 'received:74.125.83': 0.69; '12:10': 0.84; 'ian,': 0.84; 'machines,': 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:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=3c0ULGmF44OUOMBO8w/059gZLpDRW49H2NwmH2uuX9k=; b=xwJuUSj1BsM1U38VAuPiemrAhaUwhDDvrnVzwrD6E+DhupEtV2DwgjFA9yZZ4dwpwc vDPxSa5bPT5b2OT/1xjJWASql2f4aTlM90tDQsUnovM9ggVAzOdTSDK7wrA9BesPCNWo iJO0rZ9gdt0m0GWTovpjeXhB5AC13yv3Idn4U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=Jj9shuAlZO92GabeQ96kYlytIFpklE9OseBC1ITTMtc9p0bHOH84WOiVdp/BIt7TTJ GVAvySoMfNXVMIFbUDwbt6GiTJzLZvfPIGTyHcIeEv2sMxlDp+b6HoOLRZf6z5dQvXIU iZieZlZo/tcWMGw6iPBnpPna1XapFhv25vQdc= MIME-Version: 1.0 In-Reply-To: References: Date: Mon, 9 May 2011 15:10:39 -0400 Subject: Re: Inconsistency with split() - Script, OS, or Package Problem? From: James Wright To: Python Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: 35 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1304968242 news.xs4all.nl 41113 [::ffff:82.94.164.166]:51690 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:5009 Hello Ian, It does indeed to seem that way. However the script works just fine on other machines, with the same input file. Thanks, James On Mon, May 9, 2011 at 2:41 PM, Ian Kelly wrote: > On Mon, May 9, 2011 at 12:10 PM, James Wright wrot= e: >> 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. =A0It sounds like split() is getting passed a string that doesn't > contain any '_' characters at all, resulting in a sequence with only > one value. =A0Passing 1 as the second argument ensures that there will > be at most 1 split, but there may still be fewer. > > Cheers, > Ian >