<p dir="ltr">Hey thanks for replying!<br>
Yep, i found that answer, but didn't update the question.</p>
<p dir="ltr">Thanks!</p>
<br><div class="gmail_quote"><div dir="ltr">On Mon, Jun 18, 2018, 15:39 Joel Serrano <<a href="mailto:joel@textplus.com">joel@textplus.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi David, <div><br></div><div>If that happened to me I would run something like this:</div><div><br></div><div><span style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace,"Apple Color Emoji";font-size:12px;white-space:pre-wrap;background-color:rgb(30,30,30);text-decoration-style:initial;text-decoration-color:initial"><span style="text-decoration-style:initial;text-decoration-color:initial;color:rgb(220,220,170)">print</span><span style="text-decoration-style:initial;text-decoration-color:initial">(</span><span style="text-decoration-style:initial;text-decoration-color:initial;color:rgb(206,145,120)">'Test 1: </span><span style="text-decoration-style:initial;text-decoration-color:initial;color:rgb(86,156,214)">%s</span><span style="text-decoration-style:initial;text-decoration-color:initial;color:rgb(215,186,125)">\n</span><span style="text-decoration-style:initial;text-decoration-color:initial;color:rgb(206,145,120)">'</span><span style="text-decoration-style:initial;text-decoration-color:initial"> </span><span style="text-decoration-style:initial;text-decoration-color:initial">%</span><span style="text-decoration-style:initial;text-decoration-color:initial"> CampaignData)</span><br></span></div><div><span style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace,"Apple Color Emoji";font-size:12px;white-space:pre-wrap;background-color:rgb(30,30,30);text-decoration-style:initial;text-decoration-color:initial"><span style="text-decoration-style:initial;text-decoration-color:initial"><span style="background-color:rgb(30,30,30);text-decoration-style:initial;text-decoration-color:initial;color:rgb(220,220,170)">print</span><span style="background-color:rgb(30,30,30);text-decoration-style:initial;text-decoration-color:initial">(</span><span style="background-color:rgb(30,30,30);text-decoration-style:initial;text-decoration-color:initial;color:rgb(206,145,120)">'Test 2: </span><span style="background-color:rgb(30,30,30);text-decoration-style:initial;text-decoration-color:initial;color:rgb(86,156,214)">%s</span><span style="background-color:rgb(30,30,30);text-decoration-style:initial;text-decoration-color:initial;color:rgb(215,186,125)">\n</span><span style="background-color:rgb(30,30,30);text-decoration-style:initial;text-decoration-color:initial;color:rgb(206,145,120)">'</span><span style="background-color:rgb(30,30,30);text-decoration-style:initial;text-decoration-color:initial"> </span><span style="background-color:rgb(30,30,30);text-decoration-style:initial;text-decoration-color:initial">%</span><span style="background-color:rgb(30,30,30);text-decoration-style:initial;text-decoration-color:initial"> <span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">type(</span><span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">CampaignData[</span><span style="text-decoration-style:initial;text-decoration-color:initial;color:rgb(206,145,120)">'campaing_type'</span><span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">]))</span></span><br></span></span></div><div><span style="color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace,"Apple Color Emoji";font-size:12px;white-space:pre-wrap;background-color:rgb(30,30,30);text-decoration-style:initial;text-decoration-color:initial"><span style="text-decoration-style:initial;text-decoration-color:initial"><span style="background-color:rgb(30,30,30);text-decoration-style:initial;text-decoration-color:initial"><span style="text-decoration-style:initial;text-decoration-color:initial;color:rgb(220,220,170)">print</span><span style="text-decoration-style:initial;text-decoration-color:initial">(</span><span style="text-decoration-style:initial;text-decoration-color:initial;color:rgb(206,145,120)">'Test 3: </span><span style="text-decoration-style:initial;text-decoration-color:initial;color:rgb(86,156,214)">%s</span><span style="text-decoration-style:initial;text-decoration-color:initial;color:rgb(215,186,125)">\n</span><span style="text-decoration-style:initial;text-decoration-color:initial;color:rgb(206,145,120)">'</span><span style="text-decoration-style:initial;text-decoration-color:initial"> </span><span style="text-decoration-style:initial;text-decoration-color:initial">%</span><span style="text-decoration-style:initial;text-decoration-color:initial"> str(<span style="background-color:rgb(30,30,30);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">CampaignData[</span><span style="background-color:rgb(30,30,30);text-decoration-style:initial;text-decoration-color:initial;color:rgb(206,145,120)">'campaing_type'</span><span style="background-color:rgb(30,30,30);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">]))</span></span><br></span></span></span></div><div class="gmail_extra"><br><div class="gmail_quote"><br></div><div class="gmail_quote">Can you share the output?</div><div class="gmail_quote">Joel.</div><div class="gmail_quote"><br></div><div class="gmail_quote"><br></div><div class="gmail_quote"></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Jun 13, 2018 at 6:50 PM, David Villasmil <span dir="ltr"><<a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a>></span> wrote:<br></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello Guys, <div><br></div><div>I'm writing a script in python which when run via cli works properly. I get some dta via http (urllib3) and parse it like:</div><div><br></div><div><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace,"Apple Color Emoji";font-weight:normal;font-size:12px;line-height:18px;white-space:pre-wrap"><div><span style="color:rgb(212,212,212)">    r </span><span style="color:rgb(212,212,212)">=</span><span style="color:rgb(212,212,212)"> http.request(</span><span style="color:rgb(206,145,120)">'GET'</span><span style="color:rgb(212,212,212)">, </span><span style="color:rgb(206,145,120)">'<a href="https://www.massphoning.net/customer/inMassphoning/getInCampaignInfo?phone=" target="_blank">https://www.massphoning.net/customer/inMassphoning/getInCampaignInfo?phone=</a>'</span><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(212,212,212)">+</span><span style="color:rgb(212,212,212)"> caller)</span></div><br><div><span style="color:rgb(212,212,212)">    </span><span style="color:rgb(197,134,192)">if</span><span style="color:rgb(212,212,212)"> r.status </span><span style="color:rgb(212,212,212)">==</span><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(181,206,168)">200</span><span style="color:rgb(212,212,212)">:</span></div><div><span style="color:rgb(212,212,212)">        httpResult </span><span style="color:rgb(212,212,212)">=</span><span style="color:rgb(212,212,212)"> json.loads(r.data.decode(</span><span style="color:rgb(206,145,120)">'utf-8'</span><span style="color:rgb(212,212,212)">))</span></div></div><br></div><div>Then print it like:</div><div><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace,"Apple Color Emoji";font-weight:normal;font-size:12px;line-height:18px;white-space:pre-wrap"><div><span style="color:rgb(212,212,212)">        </span><span style="color:rgb(220,220,170)">print</span><span style="color:rgb(212,212,212)">(</span><span style="color:rgb(206,145,120)">'Response Parsed: </span><span style="color:rgb(86,156,214)">%s</span><span style="color:rgb(215,186,125)">\n</span><span style="color:rgb(206,145,120)">'</span><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(212,212,212)">%</span><span style="color:rgb(212,212,212)"> CampaignData)</span></div><div><span style="color:rgb(212,212,212)">        </span><span style="color:rgb(220,220,170)">print</span><span style="color:rgb(212,212,212)">(</span><span style="color:rgb(206,145,120)">'CamapignType: </span><span style="color:rgb(86,156,214)">%s</span><span style="color:rgb(215,186,125)">\n</span><span style="color:rgb(206,145,120)">'</span><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(212,212,212)">%</span><span style="color:rgb(212,212,212)"> CampaignData[</span><span style="color:rgb(206,145,120)">'campaing_type'</span><span style="color:rgb(212,212,212)">])</span></div></div> </div><div>and via the CLI works nicely.</div><div><br></div><div>But when run on freeswitch dialplan </div><div><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace,"Apple Color Emoji";font-weight:normal;font-size:12px;line-height:18px;white-space:pre-wrap"><div><span style="color:rgb(212,212,212)">        </span><span style="color:rgb(220,220,170)">print</span><span style="color:rgb(212,212,212)">(</span><span style="color:rgb(206,145,120)">'Response Parsed: </span><span style="color:rgb(86,156,214)">%s</span><span style="color:rgb(215,186,125)">\n</span><span style="color:rgb(206,145,120)">'</span><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(212,212,212)">%</span><span style="color:rgb(212,212,212)"> CampaignData)</span></div></div><div><br></div><div>runs properly and prints on the log the data, but <span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">it fails on:</span></div><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace,"Apple Color Emoji";font-weight:normal;font-size:12px;line-height:18px;white-space:pre-wrap"><div>        <span style="color:rgb(220,220,170)">print</span>(<span style="color:rgb(206,145,120)">'CamapignType: </span><span style="color:rgb(86,156,214)">%s</span><span style="color:rgb(215,186,125)">\n</span><span style="color:rgb(206,145,120)">'</span> % CampaignData[<span style="color:rgb(206,145,120)">'campaing_type'</span>])<br></div></div><div><br></div><div>with:</div><div><div><font face="monospace, monospace">2018-06-14 03:33:28.971179 [ERR] mod_python.c:164 Python Error by calling script "foo": <type 'exceptions.TypeError'></font></div><div><font face="monospace, monospace">Message: in method 'consoleLog', argument 2 of type 'char *'</font></div><div><font face="monospace, monospace">Exception: None</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">Traceback (most recent call last)</font></div><div><font face="monospace, monospace"><span style="white-space:pre-wrap">      </span>File: "/opt/freeswitch/share/freeswitch/scripts/foo.py", line 16, in handler</font></div><div><font face="monospace, monospace"><span style="white-space:pre-wrap">    </span>File: "/opt/freeswitch/share/freeswitch/scripts/foo.py", line 69, in getCampaignInfo</font></div></div><div><br></div><div>Any ideas??</div><div><br></div><div><br></div><div>Thanks!<br clear="all"><div><div dir="ltr" class="m_9169581603540397332m_5354455853043056068gmail_signature"><div dir="ltr"><div>Regards,</div><div><br></div>David Villasmil<div>email: <a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a></div><div>phone: +34669448337</div></div></div></div></div></div></div><div hspace="streak-pt-mark" style="max-height:1px"><img alt="" style="width:0px;max-height:0px;overflow:hidden" src="https://mailfoogae.appspot.com/t?sender=aZGF2aWQudmlsbGFzbWlsLndvcmtAZ21haWwuY29t&type=zerocontent&guid=9abe7077-8b82-4a0b-805f-202ca9a7efb8"><font color="#ffffff" size="1">ᐧ</font></div>
<br></blockquote></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">_________________________________________________________________________<br>
Professional FreeSWITCH Services<br>
<a href="mailto:sales@freeswitch.com" target="_blank">sales@freeswitch.com</a><br>
<a href="https://freeswitch.com" rel="noreferrer" target="_blank">https://freeswitch.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="https://freeswitch.com/oss" rel="noreferrer" target="_blank">https://freeswitch.com/oss</a><br>
<a href="https://freeswitch.org/confluence" rel="noreferrer" target="_blank">https://freeswitch.org/confluence</a><br>
<a href="https://cluecon.com" rel="noreferrer" target="_blank">https://cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="https://freeswitch.com" rel="noreferrer" target="_blank">https://freeswitch.com</a><br></blockquote></div><br></div></div>
_________________________________________________________________________<br>
Professional FreeSWITCH Services<br>
<a href="mailto:sales@freeswitch.com" target="_blank">sales@freeswitch.com</a><br>
<a href="https://freeswitch.com" rel="noreferrer" target="_blank">https://freeswitch.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="https://freeswitch.com/oss" rel="noreferrer" target="_blank">https://freeswitch.com/oss</a><br>
<a href="https://freeswitch.org/confluence" rel="noreferrer" target="_blank">https://freeswitch.org/confluence</a><br>
<a href="https://cluecon.com" rel="noreferrer" target="_blank">https://cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="https://freeswitch.com" rel="noreferrer" target="_blank">https://freeswitch.com</a></blockquote></div>