我正在尝试在Python中执行以下代码
import os,subprocess
from glob import glob
path = "/Users/armed/private_SDKs"
os.chdir(path)
for file in glob("*.framework"):
command = ['class-dump' , '-H' , file , '-o' , '~', '/Users/armed/Desktop/Headers/']
subprocess.call(command)
执行此脚本时,我收到以下错误: -
Traceback (most recent call last):
File "<pyshell#52>", line 3, in <module>
subprocess.call(command)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 493, in call
return Popen(*popenargs, **kwargs).wait()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1228, in _execute_child
raise child_exception
OSError: [Errno 13] Permission denied
非常感谢任何帮助!
答案 0 :(得分:1)
检查class-dump命令的权限。 chmod +x class-dump
如果它不可执行。以下是chmod上的文档。
如果它不在您的路径上,您可能还需要指定类转储的绝对路径。
另外,试试:
print " ".join(command)
并查看是否可以通过将结果粘贴到shell中来运行它。