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?

References <BANLkTi=g2h_BxZDdTdLqyB3nZCukD+Dupw@mail.gmail.com> <4DC838CD.7030404@stoneleaf.us>
Date 2011-05-09 15:02 -0400
Subject Re: Inconsistency with split() - Script, OS, or Package Problem?
From James Wright <jamfwright@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.1341.1304967741.9059.python-list@python.org> (permalink)

Show all headers | 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