Hi, thanks, I added paths from sys.path from python, it raises ---- python_function_load - Module 'example' not found <type 'exceptions.ImportError'> (No module named example) python_function_load - Failed to import python function 'example.instantiate' /etc/raddb/mods-enabled/python[9]: Instantiation failed for module "python" ------ On Mon, Mar 25, 2019 at 1:26 PM Юрий Иванов <format_hub@outlook.com> wrote:
Hi, This is not enough. You need to add all additional paths to variable "python_path". To get all list of paths I usually execute under python interpreter:
CentOS example: [root@radius ~]# python Python 2.7.5 (default, Aug 4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
import sys sys.path ['', '/usr/lib64/python27.zip', '/usr/lib64/python2.7', '/usr/lib64/python2.7/plat-linux2', '/usr/lib64/python2.7/lib-tk', '/usr/lib64/python2.7/lib-old', '/usr/lib64/python2.7/lib-dynload', '/usr/lib64/python2.7/site-packages', '/usr/lib/python2.7/site-packages']
------------------------------ *От:* Freeradius-Users <freeradius-users-bounces+format_hub= outlook.com@lists.freeradius.org> от имени luckydog xf < luckydogxf@gmail.com> *Отправлено:* 25 марта 2019 г. 5:32 *Кому:* FreeRadius users mailing list *Тема:* Load Python Module correctly
Hi, list,
I want to write my own python code, I added below lines.
# /etc/raddb/mods-enabled/python
python_path = "/usr/lib64/python2.7/"
module = example ---------
in /usr/lib64/python2.7/example.py, I imported required modules. # import radiusd import requests import json ... ... some other code ......
And radiusd -X raised an error:
python_function_load - Module 'example' not found <type 'exceptions.ImportError'> (No module named requests) python_function_load - Failed to import python function 'example.instantiate' /etc/raddb/mods-enabled/python[9]: Instantiation failed for module "python"
Acutally, * requests * and * json * are both available, see
# python ...... # remove unless lines ###
import radiusd import requests import json
So what's the right way to implement this? Thanks. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html