[Tutor] problem with class - get message that self is not defined
Andrew Robert
andrew.arobert at gmail.com
Mon May 22 20:28:10 CEST 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Everyone,
When I try to use the class listed below, I get the statement that self
is not defined.
test=TriggerMessage(data)
var = test.decode(self.qname)
I would have thought that self would have carried forward when I grabbed
an instance of TriggerMessage.
Any ideas on this?
The class in question is:
class TriggerMessage(object):
def __init__(self,data):
"""
Unpacks the passed binary data based on the MQTCM2 format dictated in
the MQ Application Programming Reference
"""
self.data=data
self.structid=None
self.version=None
self.qname=None
self.procname=None
self.trigdata=None
self.appltype=None
self.applid=None
self.envdata=None
self.userdata=None
self.qmgr=None
def decode(self):
import struct
format='4s 4s 48s 48s 64s 4s 256s 128s 128s 48s'
size=struct.calcsize(format)
self.data=data
self.structid, self.version, self.qname, self.processname, \
self.triggerdata, self.appltype, self.applid, \
self.envdata, self.userdata, self.qmgr \
= struct.unpack(format,self.data)
- --
Thank you,
Andrew Robert
Systems Architect
Information Technologies
MFS Investment Management
Phone: 617-954-5882
E-mail: arobert at mfs.com
Linux User Number: #201204
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (MingW32)
iD8DBQFEcgK6Dvn/4H0LjDwRArwJAKCVdcpLC7IcUzDaMN+L/hVFv8CToQCaA6hP
0KteYe8olY5/72+uktGRCco=
=ToBq
-----END PGP SIGNATURE-----
More information about the Tutor
mailing list