python with echo

Himanshu himanshu.garg at gmail.com
Wed Nov 11 21:30:57 EST 2009


2009/11/12 hong zhang <henryzhang62 at yahoo.com>:
> List,
>
> I have a question of python using echo.
>
> POWER = 14
> return_value = os.system('echo 14 > /sys/class/net/wlan1/device/tx_power')
>
> can assign 14 to tx_power
>
> But
> return_value = os.system('echo $POWER > /sys/class/net/wlan1/device/tx_power')
>
> return_value is 256 not 0. It cannot assign 14 to tx_power.
>
> What problem is it?
>
> os.system("echo $POWER") returns 0 but
> os.system("echo $POWER > /sys/class/net/wlan1/device/tx_power") returns 256.
>

Sorry cannot try it myself to confirm. Could it be that $POWER is not
set. Does it write to a regular file.

Thank You,
++imanshu



More information about the Python-list mailing list