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


Groups > comp.lang.python > #5013 > unrolled thread

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

Started byMRAB <python@mrabarnett.plus.com>
First post2011-05-09 20:25 +0100
Last post2011-05-09 20:25 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Inconsistency with split() - Script, OS, or Package Problem? MRAB <python@mrabarnett.plus.com> - 2011-05-09 20:25 +0100

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

FromMRAB <python@mrabarnett.plus.com>
Date2011-05-09 20:25 +0100
SubjectRe: Inconsistency with split() - Script, OS, or Package Problem?
Message-ID<mailman.1346.1304969147.9059.python-list@python.org>
On 09/05/2011 20:10, James Wright wrote:
> 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.
>>
 > It does indeed to seem that way.  However the script works just fine
 > on other machines, with the same input file.
 >
'each_value' gets its value from D4[report], so check which value of
'report' that is, and look at where 'D4' is filled.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web