Search code examples
pythonshsudoraspbianbanana-pi

sh 1 sudo not found python script done on ubuntu does not work on bananian


I made a script on ubuntu and now I want it to run on my banana pi with bananian (raspbian for banana pi). Here is the part where of my script I have some problems:

foundmob= False
foundusb= False

sudoPassword='figaro'#my sudo password
command="usb_modeswitch -v 12d1 -p 1f01 -M '55534243123456780000000000000011062000000100000000000000000000'" # the command that for ce the modem to be on serial mode
while foundusb!= True : # this allows me to look for the modem as an usb and then force it

    foundmob=terminalComAndRead("lsusb",'12d1:1f01')#doing a ls usb and then looking for the id of my device
    changemob=terminalComAndRead("lsusb",'12d1:1001')#this is the id of my device when it is already in serial mode

    if foundmob == True :

        os.system('echo %s|sudo -S %s' % (sudoPassword, command))# this is the line who execute the command on sudo

While I execute this script in ubuntu, I do not have any problem, but then when I want to execute it on bananian with my banana pi, I get this error:

sh: 1: sudo: not found

It seems that the error comes from this line:

os.system('echo %s|sudo -S %s' % (sudoPassword, command))# this is the line who execute the command on sudo

So tried to run it on sudo and in another log in (not sudo). But still it does not work. Anybody has an idea? Thx


Solution

  • Maybe sudo it's not in PATH or not installed. Have you verified it?