import mysql in python file fails
dy1977 at orange.fr
dy1977 at orange.fr
Sat Feb 5 13:54:58 UTC 2022
Hello,
I have been using unbound with a python file for years in Debian 10.
I am installing the system in Debian 11 but "import mysql" fails.
mysql.connector was properly installed, and if I run directly the python
file, it does not provoque any error. Here is the code
import csv, json, time, os, sys
from collections import OrderedDict
sys.path.append('/usr/local/lib/python3.9/dist-packages')
import mysql
import mysql.connector as database
But when I try to start unbound, the following error happens :
Feb 5 14:24:38 Idefix-APU2 systemd[1]: Starting Unbo
und DNS server...
Feb 5 14:24:38 Idefix-APU2 unbound: [32270:0] notice: init module 0:
validator
Feb 5 14:24:38 Idefix-APU2 unbound: [32270:0] notice: init module 1: python
Feb 5 14:24:38 Idefix-APU2 unbound[32270]: Traceback (most recent call
last):
Feb 5 14:24:38 Idefix-APU2 unbound[32270]: File
"/usr/lib/idefix/unbound-filter.py", line 20, in <module>
Feb 5 14:24:38 Idefix-APU2 unbound[32270]: import mysql
Feb 5 14:24:38 Idefix-APU2 unbound[32270]: ModuleNotFoundError: No
module named 'mysql'
Feb 5 14:24:38 Idefix-APU2 unbound: [32270:0] error: pythonmod: can't
parse Python script /usr/lib/idefix/unbound-filter.py
I have updated the sys.path.append to the new python version. In this
directory there is a 'mysql' subdirectory, and in this subdirectory
there is a __init__.py file. I do not understand what is missing.
Thanks for any help.
Dysmas
--
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus
More information about the Unbound-users
mailing list