我使用ssh连接到Raspberry Pi,并且我有一个python脚本,当按下按钮时,它会播放文件.out。关键是我可以按下按钮访问这个python文件,但是当尝试在系统中执行命令时它显示以下错误:
import time
import RPi.GPIO as GPIO
import os
GPIO.setmode(GPIO.BCM)
GPIO.setup(24, GPIO.IN, pull_up_down = GPIO.PUD_UP)
def play(channel):
os.system('./a.out')
GPIO.add_event_detect(24, GPIO.RISING, callback = play, bouncetime = 3000)
while 1:
time.sleep(1)
这是错误:
X11 connection rejected because of wrong authentication.
(focus:2532): Gtk-WARNING **: cannot open display: localhost:10.0
谢谢