[Tutor] Scope Problem with Files
Carroll, Barry
Barry.Carroll at psc.com
Wed Dec 14 23:24:17 CET 2005
Thanks, Bob. I figured it was something simple.
BGC
________________________
"Never trust anything that can think for itself
if you can't see where it keeps its brain"
JK Rowling
<<snip>>
> >
> > sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
> > sock.settimeout(timetowait)
> > retriesleft = retries
> > if DEBUG:
> > dbgf = open(dbgfname,mode="a")
>
> dbgf is a local variable. If you want to reassign to the global you
must
> add
> global dbgf
> to the function
>
> > dbgf.write("\n"+str(time.localtime())+"\n")
> >
<<snip>>
More information about the Tutor
mailing list