Re: [Tutor] Namespace Problem

2005-11-07 Thread Carroll, Barry
Kent: Thank you for the explanation. This is a subtlety of Python that has tripped me up before. Barry > Date: Mon, 07 Nov 2005 16:26:39 -0500 > From: Kent Johnson <[EMAIL PROTECTED]> > Subject: Re: [Tutor] Namespace Problem > Cc: "'tutor@python.org'&

Re: [Tutor] Namespace Problem

2005-11-07 Thread Kent Johnson
Carroll, Barry wrote: > Bob: > > Yes I did mean 'import' and yes there is more to the function. Here is the > entire program. > > > import socket > import struct > > # data packet flags > ABC = 1 > DEF = 2 > GHI = 4 > JKL = 8 > seq = 0 > > buf = 8192 # This is the ma

Re: [Tutor] Namespace Problem

2005-11-07 Thread Carroll, Barry
e 15, in do_stuff hdr = struct.pack('@2BH',ABC|DEF,seq,len(in_str)) UnboundLocalError: local variable 'seq' referenced before assignment>>>>>>>>>>>>>>>>>>>>>>>> I can't figure it out. Barry >

Re: [Tutor] Namespace Problem

2005-11-04 Thread bob
At 05:47 PM 11/4/2005, Carroll, Barry wrote: >I have a function that makes use of several global variables: > >## >Include struct Did you mean "import"? >ABC = 1 >DEF = 2 >xyz = 0 >def do_stuff(in_str): > hdr = struct.pack('@2BH',ABC|DEF,xyz,len(in_str)) > newstr = hdr+in_str Wor

[Tutor] Namespace Problem

2005-11-04 Thread Carroll, Barry
I have a function that makes use of several global variables: ## Include struct ABC = 1 DEF = 2 xyz = 0 # Other variables def do_stuff(in_str): hdr = struct.pack('@2BH',ABC|DEF,xyz,len(in_str)) newstr = hdr+in_str # rest of code snipped ## When I run the program c