我制作了一个脚本来告诉我 Raspberry Pi 3 的温度,但该脚本有问题。结果输出是机器人说“您的 RPI3 温度当前为 0”。我的代码有什么问题吗?
@bot.command(pass_context=True)
async def vcgencmdmeasure_temp(ctx):
if ctx.message.author.id == "412372079242117123":
await bot.say("OK....")
return_code = subprocess.call("vcgencmd measure_temp", shell=True)
await bot.say("KK done")
await bot.say("Your RPI3 temp is currently: {}".format(return_code))
else:
await bot.say("Error user lacks perms(only bot owner can run this)")
Run Code Online (Sandbox Code Playgroud)
编辑:我知道想要运行任何命令。当前脚本
@bot.command(pass_context=True) 异步 def rpicmd(ctx, *args):
if ctx.message.author.id == "412372079242117123":
mesg = ''.join(args)
mesg = str(mesg)
command_output = subprocess.check_output(mesg, shell=True, universal_newlines=True)
await bot.say(command_output)
else:
await bot.say("No noob")
Run Code Online (Sandbox Code Playgroud)
我收到错误:
raise CommandInvokeError(e) from e
discord.ext.commands.errors.CommandInvokeError: Command raised an …Run Code Online (Sandbox Code Playgroud) 已解决了以下有关如何在RPI3上下载HEROKU CLI的阅读答案
只是说。抱歉,之前是否有人问过-我无法找到它。
我有一个Raspberry PI 3,并且正在尝试安装Heroku CLI。如果我尝试以正常方式执行此操作(对于ubuntu或linux),它将失败。无法在Raspbian剂量wokr 上安装Heroku CLI,因为我得到了错误
wget https://cli-assets.heroku.com/branches/stable/heroku-OS-ARCH.tar.gz
Run Code Online (Sandbox Code Playgroud)
--2018-05-23 17:15:46-- https://cli-assets.heroku.com/branches/stable/heroku-OS-ARCH.tar.gz
解决cli-assets.heroku.com(cli- asset.heroku.com)... 54.230.9.187,54.230.9.194,54.230.9.84,...正在
连接至cli-assets.heroku.com(cli-assets.heroku.com)| 54.230.9.187 |:443。 .. 连接的。
HTTP请求已发送,正在等待响应... 404未找到
2018-05-23 17:15:50
错误404:未找到。
但是,此帖子可以在 Heroku CLI替代下载位置工作, 并返回错误
gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error is not recoverable: exiting now
dpkg: error processing package heroku (--configure):
subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of heroku-toolbelt:
heroku-toolbelt depends on heroku (= 3.99.4); …Run Code Online (Sandbox Code Playgroud)