在launchctl运行Python脚本 - 错误127

问题描述 投票:0回答:1

所以我试着通过在OSX LaunchAgents运行一个脚本,我不断收到服务退出,异常代码:127错误。

当我在终端运行脚本,一切正常(它只是一个测试脚本,打开一个浏览器标签页)。我已经验证了的.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>local.restart</string>
        <key>Program</key>
        <string>/Users/flp/PythonScripts/run.py</string>
        <key>RunAtLoad</key>
        <true/>
        <key>StartInterval</key> 
        <integer>60</integer>
    </dict>
</plist>

这里是脚本:

#! /usr/bin/env python3
import webbrowser

a_website = "https://www.abola.pt"

# Open url in a new window of the default browser, if possible
webbrowser.open_new(a_website)

这是从launchctl日志:

com.apple.xpc.launchd[1] (local.restart[3080]): Service exited with abnormal code: 127

难道我做错了什么?

python macos-mojave
1个回答
0
投票

问题是在家当。该编译器的路径是不正确的,固定的,它工作作为suposed。

© www.soinside.com 2019 - 2024. All rights reserved.