Skip to main content
 首页 » 编程设计

python之subprocces.call 语法错误python

2025年02月15日6kerrycode

尝试使用带有 subprocess.call 的 python 运行命令,但出现语法错误

#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 

请您参考如下方法:

使用: 来自子流程导入调用

代替: 导入调用