2017-03-27 100 views
2

嘗試運行使用python命令與subprocess.call,但我得到一個語法錯誤subprocces.call語法錯誤蟒蛇

#Takes cipher and password, executes openssl command in console 
def decrypt(cipher, password): 
    try: 
     print 'Attempting decryption ---> Cipher: ' +cipher+ ' Password: ' + password 
     call(['openssl', 'enc', '-d', cipher, '/media/"username"/Data Drive/Documents/Project mangement/forensics/images/19_1.enc','-out', 'decrypted.dat' '-k', password]) 

    except Error as e: 
     print e 

Traceback (most recent call last): 
File "/media/"username"/Data Drive/Downloads/bruteforce(2).py", line 9, in <module> 
    import call 
File "/home/"username"/.local/lib/python2.7/site-packages/call/__init__.py", line 37 
class _PythonCall(metaclass=ABCMeta): 
         ^
SyntaxError: invalid syntax 
+0

這樣看來,無論是由'進口call'進口中有一個語法錯誤,這是最有可能不是在所有相關到你發佈的代碼中......'call'不是標準庫模塊之一,所以我不知道它是什麼......除非它應該是來自「子進程調用」的東西...... – twalberg

回答

1

用途: 從子導入調用

相反的: 導入呼叫

0

元類是一個Python 3成語。所以文件"/home/"username"/.local/lib/python2.7/site-packages/call/__init__.py"來自Python 3包。然而它安裝在Python 2樹中。安裝Python的方式必須嚴重錯誤。