Launchd plist Errno 13权限被拒绝

2024-06-02 14:57:04 发布

您现在位置:Python中文网/ 问答频道 /正文

所以,我对这个有点陌生,一直在尝试自动化一个每30秒运行一次的python,但它似乎不起作用。你知道吗

这是我正在运行的plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Label</key>
        <string>com.fplautomator</string>

        <key>StandardErrorPath</key>
        <string>/Users/myname/Downloads/Errorfile.txt</string>

        <key>StandardOutPath</key>
        <string>/Users/myname/Downloads/Errorfile.txt</string>

        <key>ProgramArguments</keys>
        <array>
                <string>/Library/Frameworks/Python.framework/Versions/3.7/bin/python3</string>
                <string>/Users/myname/Documents/Misc\ -\ FPL/Python\ -\ FPL.py</string>
        </array>

        <key>StartInterval</key>
        <integer>30</integer>
</dict>
</plist>

控制台上的错误

com.apple.xpc.launchd[1] (com.fplautomator[6585]): Service exited with abnormal code: 2

从文件生成的错误消息

(null): can't open file '/Users/myname/Documents/Misc\ -\ FPL/Python\ -\ FPL.py': [Errno 13] Permission denied

我四处寻找,看到了一些线索,但没有一个答案似乎解决了我的问题。当我直接从终端运行它时,这个文件确实可以工作,而且我还有chmod555这个有问题的.py文件。你知道吗

仅供参考,我尝试运行的python文件是为了使用BeautifulSoup将数据放到同一文件夹中的.csv和.json文件中。你知道吗

有人能提供一个解决方案吗?你知道吗

干杯!你知道吗


Tags: 文件keypycomapplestringversiondownloads