将python脚本(Google助手)程序作为服务在启动时启动

时间:2019-02-27 01:41:27

标签: python service systemctl google-aiy

我有一个google aiyproject voice kit。我有设置身份验证,并且从终端运行脚本时一切正常,例如./example.py。我配置了与systemctl服务相同的脚本,并且在启动时出现此错误。

Feb 26 20:27:47 raspberrypi python3[933]: To use the Assistant API, manually start the application from the dev terminal.
Feb 26 20:27:47 raspberrypi python3[933]: See the "Turn on the Assistant API" section of the Voice Recognizer
Feb 26 20:27:47 raspberrypi python3[933]: User's Guide for more info.

我看到这段代码here

  if not os.getenv('DISPLAY') and not sys.stdout.isatty():
        print("""
To use the Assistant API, manually start the application from the dev terminal.
See the "Turn on the Assistant API" section of the Voice Recognizer
User's Guide for more info.""")
        sys.exit(1)

我对python不太熟悉,想知道为什么它不能作为服务运行。 auth令牌保存在文件中,无需交互。有没有办法我可以做到这一点。我的要求是在系统启动时,助手程序应以无头模式自动启动。

0 个答案:

没有答案