Path: csiph.com!x330-a1.tempe.blueboxinc.net!aioe.org!feeder.news-service.com!xlned.com!feeder7.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'from:addr:python': 0.09; 'kelly': 0.09; 'subject:Problem': 0.09; 'valueerror:': 0.09; 'pm,': 0.11; '>>>': 0.12; '25,': 0.12; 'wrote:': 0.14; 'from:addr:mrabarnett.plus.com': 0.16; 'from:name:mrab': 0.16; 'installs': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'received:84.92': 0.16; 'received:84.92.122': 0.16; 'received:84.92.122.60': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'reply-to:addr:python-list': 0.16; 'subject:split': 0.16; 'unpack': 0.16; 'argument': 0.16; 'traceback': 0.16; '(most': 0.16; 'fine': 0.18; 'input': 0.18; 'header:In-Reply-To:1': 0.22; 'mon,': 0.22; 'filled.': 0.23; 'last):': 0.23; 'received:84': 0.25; 'value.': 0.25; 'script': 0.26; "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; 'file': 0.35; 'characters': 0.35; 'finding': 0.35; 'header:User-Agent:1': 0.35; 'point': 0.35; 'fails': 0.35; 'reply- to:addr:python.org': 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; 'but': 0.38; 'though,': 0.39; 'to:addr:python.org': 0.39; 'where': 0.39; 'works': 0.40; '2011': 0.62; 'reply-to:no real name:2**0': 0.72; 'header:Reply-To:1': 0.72; '12:10': 0.84; 'machines,': 0.84; 'subject:Package': 0.84 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuoHAGc/yE1UXebj/2dsb2JhbACYEo1vd8cNhgwElA2EGIYe Date: Mon, 09 May 2011 20:25:40 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Inconsistency with split() - Script, OS, or Package Problem? References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: python-list@python.org 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: 27 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1304969147 news.xs4all.nl 81481 [::ffff:82.94.164.166]:50542 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:5013 On 09/05/2011 20:10, James Wright wrote: > On Mon, May 9, 2011 at 2:41 PM, Ian Kelly wrote: >> 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. 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 >>> 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.