这是我的密码:
import subprocess
def megaGetFile(fileLink,downloadFolder):
bashCommand = "mega-get --ignore-quota-warn " + fileLink + " " + downloadFolder
output = subprocess.check_output(['bash','-c', bashCommand])
print(output)
inecekLink="https://mega.nz/#!KG4FTKjA!ZF5gOE4HPnvo1Ua3kFg5QK5EvZi15enQ4yCRMs2REtA"
nereye="/home/pi/Desktop/"
inecek="https://mega.nz/#!PC4xRSqA!vYHRQ1RYEagVWAgtQsGK8QRI3AqS_BjfV2ZV-GP9Vgw"
megaGetFile(inecekLink,nereye)
inecekLink正在下载,但返回代码:b“” inecek没有下载,因为我正在删除它并返回代码:
Traceback (most recent call last):
File "./megaCMD.py", line 50, in <module>
megaGetFile(inecek,nereye)
File "./megaCMD.py", line 36, in megaGetFile
output = subprocess.check_output(['bash','-c', bashCommand])
File "/usr/lib/python3.5/subprocess.py", line 316, in check_output
**kwargs).stdout
File "/usr/lib/python3.5/subprocess.py", line 398, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['bash', '-c', 'mega-get --ignore-quota-warn https://mega.nz/#!PC4xRSqA!vYHRQ1RYEagVWAgtQsGK8QRI3AqS_BjfV2ZV-GP9Vgw /home/pi/Desktop/']' returned non-zero exit status 247
如何获得成功和错误代码?你知道吗
您需要捕获异常,例如:
相关问题 更多 >
编程相关推荐