I guess this is a python vs SWIG question more than anything else...
I'm using a C++ package with SWIG Python bindings. One of the objects I receive is a UTC time stamp from which I'm trying to extract the time stamp.
The object has the following characteristics:
>>> print type(obj)
<type 'SwigPyObject'>
>>> print dir(obj)
['__class__', '__cmp__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__hex__', '__init__', '__int__', '__le__', '__long__', '__lt__', '__ne__', '__new__', '__oct__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'acquire', 'append', 'disown', 'next', 'own']
>>> print obj
<Swig Object of type 'UtcTimeStamp *' at 0x0379F320>
How do I extract the data out of it?
UPDATE:
I've found the UTCTimeStamp class which is derived from a DateTime struct - it is part of the open source QuickFix package.
However I still don't know how to access the data. DateTime has simple getter functions such as getYear() - however, how do I access them?
import quickfix
you should be able to find the right way to call by looking atquickfix.__dict__
then the__dict__
of the class (in case I got the capitalization wrong or something) in my edit. – Wideranging