NameError
alfred6465 at my-deja.com
alfred6465 at my-deja.com
Mon Oct 9 16:07:43 EDT 2000
Hello,
I am a new Python user and am having some
problems. I have a file called test.py that
looks like the following:
import struct
def unpack_data():
f=open('C:\\cudacom\\result\\1.rp1').read()
start = 42
stop = (struct.calcsize('6s') + start)
name = struct.unpack('6s', f[start:stop])
grab_data(start,stop)
print_results(name,desc,data)
f.close()
def grab_data(start, stop):
header = 5
start = stop+header
stop = struct.calcsize('sh')+start
desc, data = struct.unpack('sh', fstart:stop])
return desc,data
def print_results(name,desc,data):
print 'Variable Name: %s' %name
print 'Descriptor: %s' %desc
print 'Data: %s' %data
print ""
return
If I open up PythonWin and type 'import test' at
the prompt I get the following error.
Traceback (innermost last):
File "<interactive input>", line 1, in ?
File "GetInfo2.py", line 42
return (descriptor, data)
^
SyntaxError: invalid syntax
If I comment out the return statement in
grab_data and the print_results call I still get
an error. It looks like this.
Traceback (innermost last):
File "<interactive input>", line 0, in ?
File "GetInfo2.py", line 10, in unpack_data
grab_data(start,stop)
NameError: grab_data
Can anyone help me? I am very confused as to
what I am doing wrong.
Thanks in advance.
Sent via Deja.com http://www.deja.com/
Before you buy.
More information about the Python-list
mailing list