python - subprocess.check_call 抛出 FileNotFoundError 即使文件存在
问题描述
我正在尝试编辑该frida-ios-dump
项目以在我的 PC 上实际工作,我目前遇到了一个奇怪的问题,我认为这与权限有关。
chmod_dir = os.path.join(PAYLOAD_PATH, os.path.basename(dump_path))
chmod_args = ('chmod', '655', chmod_dir)
try:
subprocess.check_call(chmod_args)
except subprocess.CalledProcessError as err:
print(err)
这段代码在这里抛出了这个错误:FileNotFoundError: [WinError 2] The system cannot find the file specified
但我有一种很好的感觉,那个文件确实存在,所以我添加了以下内容except
:
except FileNotFoundError:
print(chmod_dir)
print("FileNotFound, yet path exists: " + str(os.path.exists(chmod_dir)))
正如怀疑的那样,该文件确实存在!我的代码打印FileNotFound, yet path exists: True
并且由于我还打印了路径,我们可以在这里看到:C:\Users\Admin\AppData\Local\Temp\Payload\protobuf.fid
并且在手动访问该文件夹时,我确认该文件确实存在于那里。
我有一种强烈的感觉,这是一些权限问题,但我不确定我能做些什么来解决它。
注意: Python 脚本是从 Windows PowerShell 运行的,而 Windows PowerShell 又以管理员权限打开。
解决方案
推荐阅读
- docker - 在 Docker 上使用 IEx Remote Shell 无法连接到运行 Phoenix 应用程序
- spring-boot - Spring Boot Data JPA @Version 在创建时返回 0 但在数据库中为 1
- r - 在 R 中重新排序 ggplot2 中的条形图
- javascript - 使用 redux-promise 调用 API 时 Redux 状态未更新
- python - 使用熊猫在时间序列数据帧中删除数据帧行
- python - 在pygame中设置精灵旅行限制
- sqlite - Django3中的操作错误
- jmeter - 将 jmeter 中的逗号分隔值写入 txt 文件,然后重用它们
- javascript - 会话结束后重定向到登录页面
- angular - 将一个库导入另一个 NX