Problem in import sqlite3 library in freeradius python module

Mehrzad Moghaddas mehrzadmo at gmail.com
Sun Mar 3 14:44:51 CET 2019


Hi

I have tried to use sqlite3 library in freeradius 3.0.16 python module on
ubuntu 18.04 . I have installed freeradius via standard repositories .
but I got this error message :

reading pairlist file /etc/freeradius/3.0/mods-config/files/pre-proxy
  # Instantiating module "linelog" from file
/etc/freeradius/3.0/mods-enabled/linelog
  # Instantiating module "log_accounting" from file
/etc/freeradius/3.0/mods-enabled/linelog
  # Instantiating module "python" from file
/etc/freeradius/3.0/mods-enabled/python
Python version: 2.7.15rc1 (default, Nov 12 2018, 14:31:15)  [GCC 7.3.0]
python_function_load - Module 'example' not found
<type 'exceptions.ImportError'> (No module named sqlite3)
python_function_load - Failed to import python function
'example.instantiate'
/etc/freeradius/3.0/mods-enabled/python[9]: Instantiation failed for module
"python"

any other library its ok -like os socket and etc -  ! just have problem
with sqlite3 !

there is my config files :
mods-avalaible > python :

python {
        #  Path to the python modules
        #
        #  Note that due to limitations on Python, this configuration
        #  item is GLOBAL TO THE SERVER.  That is, you cannot have two
        #  instances of the python module, each with a different path.
        #

python_path="/etc/freeradius/3.0/mods-config/python:/usr/lib/python2.7/s$

        module = example


mods-config > python > example.py

import radiusd
import sqlite3

DATABASE='path/to/database.db'

def get_acls():
  con=sqlite3.connect(DATABASE)
  cur=con.execute("SELECT * FROM acl")
  acls=cur.fetchall()
  con.close()
  acl_list=[]
  for acl in acls :
....

I test python 2.7 and 3 but no differences , I tried installed freeradius
from source -freeradius 3.0.19-


what should I do ?


More information about the Freeradius-Users mailing list