<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"><meta name="Generator" content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 3.0cm 70.85pt 3.0cm;}
div.WordSection1
{page:WordSection1;}
--></style></head><body lang="ES-CL" link="#0563C1" vlink="#954F72" style="word-wrap:break-word"><div class="WordSection1"><p class="MsoNormal"><a name="_Hlk3459566"><span lang="EN-US">Hi</span></a></p><p class="MsoNormal"><span style="mso-bookmark:_Hlk3459566"><span lang="EN-US">I’m trying to run a script in python from the freeswitch dialplan. This scripts has calls to a local REDIS DB which I need to query every time a call arrives.</span></span></p><p class="MsoNormal"><span style="mso-bookmark:_Hlk3459566"><span lang="EN-US">So far I was able to compile freeswitch with mod_python, I even can run a test.py script from the fs_cli like this:</span></span></p><p class="MsoNormal"><span style="mso-bookmark:_Hlk3459566"><span lang="EN-US"> </span></span></p><p class="MsoNormal"><span style="mso-bookmark:_Hlk3459566"><span lang="EN-US">freeswitch@reverse> python test</span></span></p><p class="MsoNormal"><span style="mso-bookmark:_Hlk3459566"><span lang="EN-US">2021-06-25 16:36:36.007177 [NOTICE] mod_python.c:213 Invoking py module: test</span></span></p><p class="MsoNormal"><span style="mso-bookmark:_Hlk3459566"><span lang="EN-US">2021-06-25 16:36:36.027120 [INFO] switch_cpp.cpp:1465 test</span></span></p><p class="MsoNormal"><span style="mso-bookmark:_Hlk3459566"><span lang="EN-US">Hello</span></span></p><p class="MsoNormal"><span style="mso-bookmark:_Hlk3459566"><span lang="EN-US"> </span></span></p><p class="MsoNormal"><span style="mso-bookmark:_Hlk3459566"><span lang="EN-US">But when try to add in the test.py the “import redis” line in order to work with my redis db I’m getting : </span></span></p><p class="MsoNormal"><span style="mso-bookmark:_Hlk3459566"><span lang="EN-US"> </span></span></p><p class="MsoNormal"><span style="mso-bookmark:_Hlk3459566"><span lang="EN-US">freeswitch@reverse> python test</span></span></p><p class="MsoNormal"><span style="mso-bookmark:_Hlk3459566"><span lang="EN-US">2021-06-25 16:37:17.847161 [NOTICE] mod_python.c:213 Invoking py module: test</span></span></p><p class="MsoNormal"><span style="mso-bookmark:_Hlk3459566"><span lang="EN-US">2021-06-25 16:37:17.847161 [ERR] mod_python.c:261 Error reloading module</span></span></p><p class="MsoNormal"><span style="mso-bookmark:_Hlk3459566"><span lang="EN-US"> </span></span></p><p class="MsoNormal"><span style="mso-bookmark:_Hlk3459566"><span lang="EN-US"> </span></span></p><p class="MsoNormal"><span style="mso-bookmark:_Hlk3459566"><span lang="EN-US">2021-06-25 16:37:17.847161 [ERR] mod_python.c:165 Python Error by calling script "test": <type 'exceptions.ImportError'></span></span></p><p class="MsoNormal"><span style="mso-bookmark:_Hlk3459566"><span lang="EN-US">Message: No module named redis</span></span></p><p class="MsoNormal"><span style="mso-bookmark:_Hlk3459566"><span lang="EN-US">Exception: None</span></span></p><p class="MsoNormal"><span style="mso-bookmark:_Hlk3459566"><span lang="EN-US"> </span></span></p><p class="MsoNormal"><span style="mso-bookmark:_Hlk3459566"><span lang="EN-US">Traceback (most recent call last)</span></span></p><p class="MsoNormal"><span style="mso-bookmark:_Hlk3459566"><span lang="EN-US"> File: "/usr/share/freeswitch/scripts/test.py", line 1, in <module></span></span></p><p class="MsoNormal"><span style="mso-bookmark:_Hlk3459566"><span lang="EN-US"> </span></span></p><p class="MsoNormal"><span style="mso-bookmark:_Hlk3459566"><span lang="EN-US">Maybe I’m not getting correctly the use of pythons scripts?.. Can I use a script that calls another module?... Is possible?</span></span></p><p class="MsoNormal"><span style="mso-bookmark:_Hlk3459566"><span lang="EN-US">Or maybe there is a better way to do this?.</span></span></p><p class="MsoNormal"><span style="mso-bookmark:_Hlk3459566"><span lang="EN-US"> </span></span></p><p class="MsoNormal"><span style="mso-bookmark:_Hlk3459566"><span lang="EN-US">Thanks!</span></span></p><span style="mso-bookmark:_Hlk3459566"></span><p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#595959">Ricardo</span></b><span lang="EN-US"></span></p><p class="MsoNormal"> </p></div></body></html>