Error in Chain of Function calls

bruno at modulix onurb at xiludom.gro
Fri Jun 9 08:44:09 EDT 2006


Girish Sahani wrote:
>>Girish Sahani wrote:
>>
>>
>>>However i am getting an error at the line marked with ***.
>>
>>what error ?
> 
> ...line 266, in colocationMiner

Great. We now know at which line of an unknown file an unknown error
happens. Will use my PythonPsychicPowers(tm) now to see waht's there...

> 
>>>Also,i am getting a ValueError in the code below:
(snip)
>>>The error is:
>>>prunedNew.remove(s)
>>>ValueError: list.remove(x): x not in list
>>
>>the ValueError means exactly what it says -- have you verified that the
>>value of "s" really is present in the list?  did you really mean to
>>remove "s" and not, say, "string" ?
> 
> Yes. I want to remove s from the prunedNew list if that condition is not
> satisfied.

Anyway the error message is very clear : you're trying to remove a
non-existant item from a list. Don't try to remove non-existent items,
and you'll be fine.

Hint 1 : in-place modifying a list you're iterating upon is a sure way
to get into trouble
Hint 2 : once you removed an item from that list, you shouldn't have to
worry about deciding once again if you need to remove it...


-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"



More information about the Python-list mailing list