I'm getting the following error in pmGetArchiveEnd():
Traceback (most recent call last):
...
File "/usr/lib64/python2.6/site-packages/pcp.py", line 1391, in
pmGetArchiveEnd
status = libpcp.pmGetArchiveEnd ( tvp )
ctypes.ArgumentError: argument 1: <type 'exceptions.TypeError'>: expected
timeval instance instead of LP_timeval
I fixed it as follows, though I'm not sure if it's the right way:
--- pcp.py.O 2014-03-14 01:33:57.000000000 -0500
+++ pcp.py 2014-03-21 20:27:59.000000000 -0500
@@ -645,7 +645,7 @@ libpcp.pmGetArchiveLabel.restype = c_int
libpcp.pmGetArchiveLabel.argtypes = [ POINTER(pmLogLabel) ]
libpcp.pmGetArchiveEnd.restype = c_int
-libpcp.pmGetArchiveEnd.argtypes = [ timeval ]
+libpcp.pmGetArchiveEnd.argtypes = [ POINTER(timeval) ]
libpcp.pmGetInDomArchive.restype = c_int
libpcp.pmGetInDomArchive.argtypes = [
@@ -1384,11 +1384,11 @@ class pmContext( object ):
def pmGetArchiveEnd( self ):
"""PMAPI - Get the last recorded timestamp from the archive
"""
- tvp = POINTER(timeval)()
+ tvp = timeval()
status = libpcp.pmUseContext( self.ctx )
if status < 0:
raise pmErr, status
- status = libpcp.pmGetArchiveEnd ( tvp )
+ status = libpcp.pmGetArchiveEnd ( byref(tvp) )
if status < 0:
raise pmErr, status
return status, tvp
Can someone please review? Thanks.
On a related note, is the loglabel argument to pmGetArchiveLabel()
necessary, given that it's called similar to pmGetArchiveEnd()?
Jonathan Lim
|