Unbound-users Digest, Vol 26, Issue 5
dy1977 at orange.fr
dy1977 at orange.fr
Sun Feb 6 17:53:52 UTC 2022
Message: 2
Date: Sat, 05 Feb 2022 10:12:11 -0500
From: Scott Kitterman<sklist at kitterman.com>
To:unbound-users at lists.nlnetlabs.nl
Subject: Re: import mysql in python file fails
Message-ID: <1648779.WJfAKapXx7 at localhost>
Content-Type: text/plain; charset="us-ascii"
If the module is installed correctly you should not have to manually modify
sys.path. I would look into whatever caused you to consider doing that and
try and address that. That may be your root cause issue.
On Debian systems with the Debian provided python3,/usr/local/lib/python3.X/
dist-packages is already in the system path.
Scott K
Hello, Scott,
you are right for python3 modules installed by apt, but for those which
are installed by pip3, they are installed in the path I needed to add.
But eventually, the source of the problem turned to be totally different.
It was the application apparmor, installed by default in Debian 11 (and
already in 10) which prevented Unbound to read files outside the unbound
installation zone (if I may say). After I posted the message below, I
discovered that the script was unable to read /proc/net/arp (permission
denied) which is a nonsense for a file with 444 permission. And I knew
(but didn't understand it was related) that unbound was also unable to
write to the logfile I defined. All this was blocked by apparmor. I
uninstalled this package, and then the problem disappeared.
I remember now I had the problem years ago when I installed unbound on
Debian 10. I think this could be detected by unbound-checkconf which
could warn that the log file is not writable, (and maybe dectect
apparmor is responsible ?).
For me it is fixed. I wonder is other users may encounter the problem.
Sincerely
Dysmas
> Send Unbound-users mailing list submissions to
> unbound-users at lists.nlnetlabs.nl
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.nlnetlabs.nl/mailman/listinfo/unbound-users
> or, via email, send a message with subject or body 'help' to
> unbound-users-request at lists.nlnetlabs.nl
>
> You can reach the person managing the list at
> unbound-users-owner at lists.nlnetlabs.nl
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Unbound-users digest..."
>
>
> Today's Topics:
>
> 1. import mysql in python file fails (dy1977 at orange.fr)
> 2. Re: import mysql in python file fails (Scott Kitterman)
> 3. Re: Unbound 1.15.0rc1 pre-release (A. Schulze)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Sat, 5 Feb 2022 14:54:58 +0100
> From: dy1977 at orange.fr
> To: unbound-users at lists.nlnetlabs.nl
> Subject: import mysql in python file fails
> Message-ID: <881b2e77-ec1d-ec66-591a-a75160742ade at orange.fr>
> Content-Type: text/plain; charset=utf-8; format=flowed
>
> 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