Hi Lars

Thanks for your input. The path is same for both conditions. But I
cannot import ctypes while executing through ubus.

Execute shell script:
===============
root@OpenWrt:~# sh foo call tx_power

{ "hello": "yyyyyyyyyyyyyyyyyyy" }
root@OpenWrt:~#
root@OpenWrt:~#
root@OpenWrt:~#
root@OpenWrt:~# cat /tmp/pythonpath.out
/root
/mnt/usb/usr/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg
/mnt/usb/usr/lib/python27.zip
/mnt/usb/usr/lib/python2.7
/mnt/usb/usr/lib/python2.7/plat-linux2
/mnt/usb/usr/lib/python2.7/lib-tk
/mnt/usb/usr/lib/python2.7/lib-old
/mnt/usb/usr/lib/python2.7/lib-dynload
/mnt/usb/usr/lib/python2.7/site-packages
/mnt/usb/usr/lib/python2.7/site-packages/setuptools-7.0-py2.7.eggroot@OpenWrt:~#
root@OpenWrt:~#

Execute shell script via ubus:
=====================

root@OpenWrt:~# rm /tmp/pythonpath.out
root@OpenWrt:~#
root@OpenWrt:~#
root@OpenWrt:~# ubus call  foo tx_power
{
    "hello": "yyyyyyyyyyyyyyyyyyy"
}
root@OpenWrt:~#
root@OpenWrt:~#
root@OpenWrt:~# cat /tmp/pythonpath.out
/root
/mnt/usb/usr/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg
/mnt/usb/usr/lib/python27.zip
/mnt/usb/usr/lib/python2.7
/mnt/usb/usr/lib/python2.7/plat-linux2
/mnt/usb/usr/lib/python2.7/lib-tk
/mnt/usb/usr/lib/python2.7/lib-old
/mnt/usb/usr/lib/python2.7/lib-dynload
/mnt/usb/usr/lib/python2.7/site-packages
/mnt/usb/usr/lib/python2.7/site-packages/setuptools-7.0-py2.7.eggroot@OpenWrt:~#
root@OpenWrt:~#

Best Regards
Phani

On Thu, Apr 5, 2018 at 9:47 PM, Lars Kruse <li...@sumpfralle.de> wrote:
> Hello Phani,
>
>
> Am Wed, 4 Apr 2018 15:02:13 -0500
> schrieb Phani Siriki <yvsg.pha...@gmail.com>:
>
>> I am able to import the module through normal execution. However it is
>> not working in rpcd shell script. Could you please give me some
>> inputs?
>
> you could try to compare the search path under both conditions.
>
> Probably the following would be sufficient?
>
>  open("/tmp/pythonpath.out", "w").write("\n".join(sys.path))
>
> (to be placed before the critical import statement)
>
>
> Cheers,
> Lars
> _______________________________________________
> openwrt-users mailing list
> openwrt-users@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-users
_______________________________________________
openwrt-users mailing list
openwrt-users@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-users

Reply via email to