0

ubuntuでスクリプトを作成しましたが、バナナパイでバナナパイ(バナナパイのラズビアン)で実行したいと思います。これが私のスクリプトの一部で、いくつかの問題があります。

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

このスクリプトを ubuntu で実行しても問題はありませんが、バナナ pi を使用してバナナで実行すると、次のエラーが発生します。

sh: 1: sudo: 見つかりません

エラーは次の行から発生しているようです。

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

そのため、sudo と別のログイン (sudo ではない) で実行しようとしました。しかし、それでもうまくいきません。誰にもアイデアがありますか?どうも

4

2 に答える 2

2

sudo PATH にないか、インストールされていない可能性があります。確認しましたか?

于 2015-04-23T16:07:40.483 に答える
0

そのエラー メッセージは、python スクリプトがコマンドを見つけられないことを示していますsudo。bananian のインストールにはsudoコマンドがありますか? sudoコマンドに必要な特権を取得する必要がありusb_modeswitchますか?

于 2015-04-23T16:10:31.523 に答える