2

I am trying to import RRDtool into Python as I want to access an RRD database using Python, but when I am trying to import rrdtool I am getting the following error.

Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path.append('/opt/rrdtool-1.4.5/bin')
>>> import rrdtool
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named rrdtool

My RRDtool is located in /opt/rrdtool-1.4.5/bin.

4 Answers 4

2

Well, the problem is solved just by executing the following command.

sudo apt-get install python-rrd

Sign up to request clarification or add additional context in comments.

Comments

0

You probably need py-rrdtool, which you could get directly from the site or your package manager.

1 Comment

i have created a directory under /opt/rrdtool-1.4.5/lib/ and name of the dir is python2.6/ and inside that i have these files init.py Makefile MANIFEST.in README.txt setup.py and now i have set the path as sys.path.append('/opt/rrdtool-1.4.5/lib/python2.6/') but still getting the same error
0

It is unlikely that Python modules are located inside a 'bin' folder. And importing files from some configured path requires that the referred path is a proper Python package. It means it must contain an __init__.py file.

1 Comment

so what exactly i should do ?
0

You could use the RRDtool documentation for inspiration (man rrdpyton). Something along the lines of

import sys
sys.path.append('/path/to/rrdtool/lib/python2.6/site-packages/')
import rrdtool

should do the trick.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.