0
我想通過python中的命令行創建一個AVD(Android虛擬設備)。爲此,我需要將一個字符串n
傳遞給stdin。我曾嘗試以下在stdin中傳遞字符串
emulator_create = str(subprocess.check_output([android,'create', 'avd', '-n', emulator_name, '-t', target_id, '-b', abi],stdin=PIPE))
emulator_create.communicate("n")
,但它提出了以下錯誤
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['/home/fahim/Android/Sdk/tools/android', 'create', 'avd', '-n', 'samsung_1', '-t', '5', '-b', 'android-tv/x86']' returned non-zero exit status 1
Process finished with exit code 1
我能做些什麼?
您應該捕獲錯誤並檢查異常的'output'屬性。 –