Hi Everyone,
I am having a problem with a class and hope you can help.
When I try to use the class listed below, I get the statement that self
is not defined.
test=TriggerMes sage(data)
var = test.decode(sel f.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,d ata):
"""
Unpacks the passed binary data based on the MQTCM2 format dictated in
the MQ Application Programming Reference
"""
self.data=data
self.structid=N one
self.version=No ne
self.qname=None
self.procname=N one
self.trigdata=N one
self.appltype=N one
self.applid=Non e
self.envdata=No ne
self.userdata=N one
self.qmgr=None
def decode(self):
import struct
format='4s 4s 48s 48s 64s 4s 256s 128s 128s 48s'
size=struct.cal csize(format)
self.data=data
self.structid, self.version, self.qname, self.processnam e, \
self.triggerdat a, self.appltype, self.applid, \
self.envdata, self.userdata, self.qmgr \
= struct.unpack(f ormat,self.data )
I am having a problem with a class and hope you can help.
When I try to use the class listed below, I get the statement that self
is not defined.
test=TriggerMes sage(data)
var = test.decode(sel f.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,d ata):
"""
Unpacks the passed binary data based on the MQTCM2 format dictated in
the MQ Application Programming Reference
"""
self.data=data
self.structid=N one
self.version=No ne
self.qname=None
self.procname=N one
self.trigdata=N one
self.appltype=N one
self.applid=Non e
self.envdata=No ne
self.userdata=N one
self.qmgr=None
def decode(self):
import struct
format='4s 4s 48s 48s 64s 4s 256s 128s 128s 48s'
size=struct.cal csize(format)
self.data=data
self.structid, self.version, self.qname, self.processnam e, \
self.triggerdat a, self.appltype, self.applid, \
self.envdata, self.userdata, self.qmgr \
= struct.unpack(f ormat,self.data )
Comment