I'm writing a Collectd plugin that calls an external API. For this I wish to
use the requests Python library. In my collectd.conf file I added:
LoadPlugin python
<Plugin python>
ModulePath "/usr/lib/collectd/"
Import "module_name"
<Module module_name>
...
</Module>
</Plugin>
In my Python file I imported the packages with:
import collectd
import requests
But I am faced with this error when I start Collectd:
Apr 23 17:51:30 home collectd[100272]: python plugin: Error importing module
"need_restart".
Apr 23 17:51:30 home collectd[100272]: Unhandled python exception in
importing module: ImportError: dynamic module does not define module export
function (PyInit_email)
When I remove the import requests line the error disappears. Do I need to
provide a path to the external Python packages to import them? From what I
understand Collectd launches its own Python interpreter, which might explain
the issue with the import.
I did try providing a path to my site-packages, but all in vain:
ModulePath "/usr/lib/python3.8/site-packages/"
--
Sent from: http://collectd.1051573.n5.nabble.com/
_______________________________________________
collectd mailing list
collectd@verplant.org
https://mailman.verplant.org/listinfo/collectd