Discussion:
[rrd-users] Use RRDTool On Windows With Python - Cant import rrdtool
AzureBell
2007-02-05 02:50:52 UTC
Permalink
RRDtool 1.2.12 Python 2.4 Windows binary

Instructions are:

Install Python (version 2.4 works for me).
Copy all 5 dlls and test_rrd.py to your_directory.
chdir your_directory
python test_rrd.py
A test RRD database will be created and some random data saved to it,
then a graph will be shown. That is all.

So I have done this - and all I get back is :

Traceback (most recent call last):
File "<console>", line 0, in <module>
ImportError: No module named rrdtool

I have the 5 dlls sitting in my local directory.

So, the instructions are pretty brief and clear .. so why is it not working?
--
View this message in context: http://www.nabble.com/Use-RRDTool-On-Windows-With-Python---Cant-import-rrdtool-tf3172333.html#a8800285
Sent from the RRDTool - User mailing list archive at Nabble.com.
Mark Easton
2007-02-05 03:23:55 UTC
Permalink
So, I have looked at the ctypes function. Why was that not covered off in the
instructions as posted by Miro when he created the dlls. Surely his code
does not work or am I missing something?? So, now I have :

rom ctypes import *
rrdtool = cdll.LoadLibrary("rrdtool.dll")
import os
import time
import random
import math

if os.path.exists('test.rrd'):
os.remove('test.rrd')

start = int( time.mktime( (2006,1,1,0,0,0,0,0,-1) ) )
end = int( time.mktime( (2006,1,3,0,0,0,0,0,-1) ) )

print 'rrdtool Python test'
print 'time start: ',start, ' end: ',end

print 'creating rrd database ...'
rrdtool.create( 'test.rrd', \
'--start', str(start), \
'DS:speed:GAUGE:60:U:U', \
'RRA:AVERAGE:0.5:1:%s' % (24 * 60), \
'RRA:AVERAGE:0.5:10:%s' % (32 * 24 * 6), \
'RRA:MAX:0.5:1:%s' % (24 * 60), \
'RRA:MAX:0.5:10:%s' % (32 * 24 * 6) )

...



But I get this response:

rrdtool Python test
time start: 1136026800 end: 1136199600
creating rrd database ...
Traceback (most recent call last):
File "E:\work\komodo\gopher\test_rrd.py", line 19, in <module>
rrdtool.create( 'test.rrd', \
File "C:\Python25\lib\ctypes\__init__.py", line 325, in __getattr__
func = self.__getitem__(name)
File "C:\Python25\lib\ctypes\__init__.py", line 330, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: function 'create' not found


So, it does not find the rrdtool funrtion "create". What must I do now?
--
View this message in context: http://www.nabble.com/Use-RRDTool-On-Windows-With-Python---Cant-import-rrdtool-tf3172333.html#a8800501
Sent from the RRDTool - User mailing list archive at Nabble.com.
Mark Easton
2007-02-05 18:05:46 UTC
Permalink
With the help of Alex van den Bogaerdt I now know that the problem lies with
Python25. The extension breaks under 2.5. Once I changed to Python 2.4 it
worked fine.
Post by Mark Easton
So, I have looked at the ctypes function. Why was that not covered off in
the instructions as posted by Miro when he created the dlls. Surely his
rom ctypes import *
rrdtool = cdll.LoadLibrary("rrdtool.dll")
import os
import time
import random
import math
os.remove('test.rrd')
start = int( time.mktime( (2006,1,1,0,0,0,0,0,-1) ) )
end = int( time.mktime( (2006,1,3,0,0,0,0,0,-1) ) )
print 'rrdtool Python test'
print 'time start: ',start, ' end: ',end
print 'creating rrd database ...'
rrdtool.create( 'test.rrd', \
'--start', str(start), \
'DS:speed:GAUGE:60:U:U', \
'RRA:AVERAGE:0.5:1:%s' % (24 * 60), \
'RRA:AVERAGE:0.5:10:%s' % (32 * 24 * 6), \
'RRA:MAX:0.5:1:%s' % (24 * 60), \
'RRA:MAX:0.5:10:%s' % (32 * 24 * 6) )
...
rrdtool Python test
time start: 1136026800 end: 1136199600
creating rrd database ...
File "E:\work\komodo\gopher\test_rrd.py", line 19, in <module>
rrdtool.create( 'test.rrd', \
File "C:\Python25\lib\ctypes\__init__.py", line 325, in __getattr__
func = self.__getitem__(name)
File "C:\Python25\lib\ctypes\__init__.py", line 330, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: function 'create' not found
So, it does not find the rrdtool funrtion "create". What must I do now?
--
View this message in context: http://www.nabble.com/Use-RRDTool-On-Windows-With-Python---Cant-import-rrdtool-tf3172333.html#a8811523
Sent from the RRDTool - User mailing list archive at Nabble.com.
Loading...