Wadda ya mean it's not defined? Impossible Error?
David Gilbert
dgilbert at dsl.ca
Mon Jun 4 21:57:11 EDT 2001
Not the case here. the function is being called by the following code
snippet:
files = []
sampdef = {}
for i in range(2,len(sys.argv)):
files.append(sys.argv[i]+("/%04s/%02s" % (year, month)) +
"/%d/%02d%02d.log")
sampdef[('+', i)] = []
sampdef[('-', i)] = []
print files
samples = {}
skip = 1
minCache = {}
names = ingestMapfile("/u/dgilbert/rules/hadrian3.rules.map")
samples = parseLogs(files, names)
... and "print files" produces the following output:
['2/2001/05/%d/%02d%02d.log', '3/2001/05/%d/%02d%02d.log']
Adonis wrote:
> just initialize paths; like in C/C++ (in idea)
> def parseLogs(paths = '', custs): # should initialize path to NULL
>
> and your error should go away...
>
> David Gilbert wrote:
>
> > I'm getting what appears to be an impossible error. Here's a code
> > 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?
> >
> > Dave.
More information about the Python-list
mailing list