Wadda ya mean it's not defined? Impossible Error?
Martin von Loewis
loewis at informatik.hu-berlin.de
Tue Jun 5 04:43:57 EDT 2001
David Gilbert <dgilbert at dsl.ca> writes:
> I'm getting what appears to be an impossible error.
That sounds like a bug to me. What Python version? If possible, please
submit a complete test case to sf.net/projects/python.
> snippet:
>
> def parseLogs(paths, custs):
>
> ipfRecord = re.compile("^([0-9]+)[ ]+([0-9]+)[
> ]+([0-9a-z]+)([+-])")
>
> last = {}
> for i in range(len(paths)): # Create start times
> ... and so on.
>
> Here's the error snippet:
>
> File "../devel/ditty/bandsaw2.py", line 37, in parseLogs
> for i in range(len(paths)): # Create start times
> UnboundLocalError: local variable 'paths' referenced before assignment
>
> Just when should "paths" be assigned?
There is, of course, a possible completion of this program that would
produce such an error. What if the rest of the module read:
def parseLogs(foo, bar):
return paths # line 37
I.e. are you sure you are executing the Python code you are looking at?
Regards,
Martin
More information about the Python-list
mailing list