0

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

Max Taylor
  • 129
  • 3
  • 15

2 Answers2

2

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

Chris
  • 1,140
  • 15
  • 30
  • you are right! but I thought I had used sudo before in the terminal. Like sudo apt-get... But anyway, thank you! – Max Taylor Apr 24 '15 at 07:49
0

That error message is saying that the python script can't find the sudo command. Does the bananian install have a sudo command? Do you need sudo to get the privileges you need for the usb_modeswitch command?

Michael Baltaks
  • 2,141
  • 19
  • 22
  • I think I do. This part of the script, I did it on my ubuntu, and I remember that I needed to use sudo to do that. thank you – Max Taylor Apr 24 '15 at 07:41