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


Groups > comp.lang.python > #5009

Re: Inconsistency with split() - Script, OS, or Package Problem?

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 <jamfwright@gmail.com>
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 <BANLkTinT+W-D8pr+sEAnFK_7k1WgmiP8iA@mail.gmail.com>
References <BANLkTi=g2h_BxZDdTdLqyB3nZCukD+Dupw@mail.gmail.com> <BANLkTinT+W-D8pr+sEAnFK_7k1WgmiP8iA@mail.gmail.com>
Date Mon, 9 May 2011 15:10:39 -0400
Subject Re: Inconsistency with split() - Script, OS, or Package Problem?
From James Wright <jamfwright@gmail.com>
To Python <python-list@python.org>
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 <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.1343.1304968241.9059.python-list@python.org> (permalink)
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

Show key headers only | View raw


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 <ian.g.kelly@gmail.com> wrote:
> On Mon, May 9, 2011 at 12:10 PM, James Wright <jamfwright@gmail.com> wrote:
>> Hello,
>>
>> I have been using a script on several boxes that have been around for
>> a while, and everything works just fine.  I am finding though, that on
>> some new OS installs the script fails with:
>>
>> Traceback (most recent call last):
>>  File "render4.py", line 114, in <module>
>>    create_report_index(each_item)
>>  File "render4.py", line 25, in create_report_index
>>    [clean_name, _] = 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
>

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


Thread

Re: Inconsistency with split() - Script, OS, or Package Problem? James Wright <jamfwright@gmail.com> - 2011-05-09 15:10 -0400
  Re: Inconsistency with split() - Script, OS, or Package Problem? Alex Willmer <alex@moreati.org.uk> - 2011-05-09 13:02 -0700
    Re: Inconsistency with split() - Script, OS, or Package Problem? James Wright <jamfwright@gmail.com> - 2011-05-09 16:08 -0400

csiph-web