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


Groups > comp.lang.python > #5007

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

Path csiph.com!x330-a1.tempe.blueboxinc.net!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.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.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'though.': 0.07; 'python': 0.07; '%s"': 0.09; 'subject:Problem': 0.09; 'valueerror:': 0.09; '~ethan~': 0.09; 'pm,': 0.11; 'def': 0.13; 'wrote:': 0.14; "'w')": 0.16; 'furman': 0.16; 'grep': 0.16; 'guessing': 0.16; 'subject:split': 0.16; 'unpack': 0.16; '\xa0for': 0.16; 'traceback': 0.16; '(most': 0.16; 'thanks,': 0.17; 'why.': 0.19; 'cc:no real name:2**0': 0.20; 'cc:2**0': 0.20; 'header:In-Reply- To:1': 0.22; 'cc:addr:python-list': 0.22; 'mon,': 0.22; 'last):': 0.23; 'received:209.85.212': 0.25; 'index': 0.25; 'creating': 0.26; "i'm": 0.26; 'message-id:@mail.gmail.com': 0.28; 'string': 0.29; 'subject:?': 0.29; 'cc:addr:python.org': 0.31; 'does': 0.31; "skip:' 10": 0.32; 'thank': 0.32; 'skip:e 20': 0.33; 'using': 0.34; 'skip:" 10': 0.34; 'file': 0.35; 'point': 0.35; 'suggested': 0.35; 'wright': 0.35; 'hello,': 0.36; 'report': 0.37; 'data': 0.37; 'received:209.85': 0.37; 'subject:with': 0.37; 'received:google.com': 0.38; 'current': 0.38; '8bit%:6': 0.39; 'could': 0.39; 'where': 0.39; 'received:209': 0.39; 'add': 0.39; '8bit%:8': 0.39; 'header:Received:5': 0.40; 'simple': 0.60; '2011': 0.62; '26,': 0.68; 'ethan,': 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:cc:content-type :content-transfer-encoding; bh=oataMyL6wmBJ8UcQ1eMGYDvmlOBiEdHe9Vgin3rocSg=; b=nCd/mz3oy8acqOcZUs08pcXmc7xP2siTIDjMcu2uhw/hvl0LCjpVIrThV16p92jtLC hWlsa/q6voWHGYDWSPi7rlc2FBfGbrE+Ql1LsDyuBpBsPNNWppFC0xtKG31zdFk1GvFf tsXkjRcxNENHPTjUPNx2ZksaIEih8IC6SOX4k=
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 :cc:content-type:content-transfer-encoding; b=lSdw+WcLqQSTjqt+rKREm4iyQTIxVSvtgZOTZhZfdF8rQuWLxqacBMiy3J6dAFU0jf bAAaW5EZDkkOyV0P7FP+0v/Dah9yCufZimhZGIiPc188eVwCS1G81hngsaS7o23f2UXj Bz4aTynDwZf4hH5ORoEQazbcTdxW/oQif4zRQ=
MIME-Version 1.0
In-Reply-To <4DC838CD.7030404@stoneleaf.us>
References <BANLkTi=g2h_BxZDdTdLqyB3nZCukD+Dupw@mail.gmail.com> <4DC838CD.7030404@stoneleaf.us>
Date Mon, 9 May 2011 15:02:17 -0400
Subject Re: Inconsistency with split() - Script, OS, or Package Problem?
From James Wright <jamfwright@gmail.com>
To Ethan Furman <ethan@stoneleaf.us>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
Cc python-list@python.org
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.1341.1304967741.9059.python-list@python.org> (permalink)
Lines 57
NNTP-Posting-Host 82.94.164.166
X-Trace 1304967741 news.xs4all.nl 34849 [::ffff:82.94.164.166]:39507
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:5007

Show key headers only | View raw


Thank you Ethan,

This is what I see now:

# python render4.py
current each_value is: vsr
Traceback (most recent call last):
  File "render4.py", line 115, in <module>
    create_report_index(each_item)
  File "render4.py", line 26, in create_report_index
    [clean_name, _] = each_value.split('_', 1)
ValueError: need more than 1 value to unpack

# grep -i vsr *
#

Using the informational line you suggested I see that 'vsr' showing as
the current each_value.  The string 'vsr' does not exist in my data
though.  Where could this be coming from?


Thanks,
James


On Mon, May 9, 2011 at 2:56 PM, Ethan Furman <ethan@stoneleaf.us> wrote:
> James Wright wrote:
>>
>> Hello,
>
> Howdy!
>
>> def create_report_index(report):  #Here we are creating a simple
>> index.html file from data in a text file
>>    newfile = open(report + '.html', 'w') #Create the index file using
>> report name
>>    for each_value in D4[report]:
>>        [clean_name, _] = each_value.split('_', 1)
>>        newfile.write('<a href="' + report +'//' + each_value +
>> '/index.htm">' + clean_name + '</a><BR>\n')
>
> Add the line
>
>    print("current each_value is: %s" % each_value)
>
> just before the line
>
>    [clean_name, _] = each_value.split('_', 1)
>
>
> I'm guessing you'll see a value with no '_' in it -- at that point you can
> track down why.
>
> ~Ethan~
>

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


Thread

Re: Inconsistency with split() - Script, OS, or Package Problem? James Wright <jamfwright@gmail.com> - 2011-05-09 15:02 -0400

csiph-web