久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    1. <legend id='XUauh'><style id='XUauh'><dir id='XUauh'><q id='XUauh'></q></dir></style></legend>
      <i id='XUauh'><tr id='XUauh'><dt id='XUauh'><q id='XUauh'><span id='XUauh'><b id='XUauh'><form id='XUauh'><ins id='XUauh'></ins><ul id='XUauh'></ul><sub id='XUauh'></sub></form><legend id='XUauh'></legend><bdo id='XUauh'><pre id='XUauh'><center id='XUauh'></center></pre></bdo></b><th id='XUauh'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='XUauh'><tfoot id='XUauh'></tfoot><dl id='XUauh'><fieldset id='XUauh'></fieldset></dl></div>
      <tfoot id='XUauh'></tfoot>

      <small id='XUauh'></small><noframes id='XUauh'>

          <bdo id='XUauh'></bdo><ul id='XUauh'></ul>
      1. 如何捕獲 subprocess.call 的輸出

        How to capture output of subprocess.call(如何捕獲 subprocess.call 的輸出)

              <small id='S78f5'></small><noframes id='S78f5'>

              <i id='S78f5'><tr id='S78f5'><dt id='S78f5'><q id='S78f5'><span id='S78f5'><b id='S78f5'><form id='S78f5'><ins id='S78f5'></ins><ul id='S78f5'></ul><sub id='S78f5'></sub></form><legend id='S78f5'></legend><bdo id='S78f5'><pre id='S78f5'><center id='S78f5'></center></pre></bdo></b><th id='S78f5'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='S78f5'><tfoot id='S78f5'></tfoot><dl id='S78f5'><fieldset id='S78f5'></fieldset></dl></div>
                <bdo id='S78f5'></bdo><ul id='S78f5'></ul>
                <legend id='S78f5'><style id='S78f5'><dir id='S78f5'><q id='S78f5'></q></dir></style></legend>
                    <tbody id='S78f5'></tbody>

                  <tfoot id='S78f5'></tfoot>
                • 本文介紹了如何捕獲 subprocess.call 的輸出的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我制作了一個腳本,告訴我 Raspberry Pi 3 的溫度,但腳本有問題.結果輸出是機器人說您的 RPI3 溫度當前為 0".我的代碼有什么問題?

                  I have made a script that tells me the temperature of my Raspberry Pi 3, but there is a problem with the script. The result output is the bot saying "Your RPI3 temp is currently 0". What is wrong with my code?

                  @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)")
                  

                  我知道想要運行任何命令.當前腳本

                  i know want to run any command. Current script

                  @bot.command(pass_context=True)async def rpicmd(ctx, *args):

                  @bot.command(pass_context=True) async 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")
                  

                  我得到了錯誤:

                  raise CommandInvokeError(e) from e
                  discord.ext.commands.errors.CommandInvokeError: Command raised an 
                   exception: CalledProcessError: Command 'vcgencmdmeasure_temp' returned 
                    non-zero exit status 12
                  

                  推薦答案

                  return_code 會有進程的返回碼.當一個進程成功存在(沒有錯誤)時,它返回一個代碼0.如果出錯,則返回 1 代碼(或非零值).如果你想要程序的輸出(它打印到 stdout),這是獲得它的一種方法:

                  return_code will have the return code of the process. When a process exists successfully (without error), it returns a code of 0. If it errors, it returns a code of 1 (or something non-zero). If you want the output of the program (that it prints to stdout), this is one way to get it:

                  p = subprocess.run("vcgencmd measure_temp", shell=True,stdout=subprocess.PIPE)
                  result = p.stdout.decode()
                  await bot.say("Your RPI3 temp is currently: {}".format(result))
                  

                  這篇關于如何捕獲 subprocess.call 的輸出的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How to make a discord bot that gives roles in Python?(如何制作一個在 Python 中提供角色的不和諧機器人?)
                  Discord bot isn#39;t responding to commands(Discord 機器人沒有響應命令)
                  Can you Get the quot;About mequot; feature on Discord bot#39;s? (Discord.py)(你能得到“關于我嗎?Discord 機器人的功能?(不和諧.py))
                  message.channel.id Discord PY(message.channel.id Discord PY)
                  How do I host my discord.py bot on heroku?(如何在 heroku 上托管我的 discord.py 機器人?)
                  discord.py - Automaticaly Change an Role Color(discord.py - 自動更改角色顏色)
                • <legend id='1jvEk'><style id='1jvEk'><dir id='1jvEk'><q id='1jvEk'></q></dir></style></legend><tfoot id='1jvEk'></tfoot>
                            <bdo id='1jvEk'></bdo><ul id='1jvEk'></ul>
                            <i id='1jvEk'><tr id='1jvEk'><dt id='1jvEk'><q id='1jvEk'><span id='1jvEk'><b id='1jvEk'><form id='1jvEk'><ins id='1jvEk'></ins><ul id='1jvEk'></ul><sub id='1jvEk'></sub></form><legend id='1jvEk'></legend><bdo id='1jvEk'><pre id='1jvEk'><center id='1jvEk'></center></pre></bdo></b><th id='1jvEk'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='1jvEk'><tfoot id='1jvEk'></tfoot><dl id='1jvEk'><fieldset id='1jvEk'></fieldset></dl></div>

                            <small id='1jvEk'></small><noframes id='1jvEk'>

                              <tbody id='1jvEk'></tbody>
                            主站蜘蛛池模板: 国产探花在线观看视频 | h视频免费在线观看 | 人人爱干 | 国产精品久久精品 | 亚洲91视频| 爱高潮www亚洲精品 中文字幕免费视频 | 在线播放第一页 | 看片一区| 国产成人免费视频 | 成人精品系列 | 成人在线看片 | 日韩电影一区 | 久热精品在线观看视频 | 久久午夜精品福利一区二区 | 精品国产一区二区三区久久狼黑人 | 国产羞羞视频在线观看 | 91麻豆精品一区二区三区 | 欧美日韩一区二区在线观看 | 最新中文字幕在线播放 | 国产精品久久久久久久午夜片 | 一级欧美一级日韩片免费观看 | 久久福利 | 精品国产青草久久久久福利 | 中文字幕不卡视频在线观看 | 欧美a级成人淫片免费看 | 国产传媒在线观看 | 视频一区在线观看 | 欧美一级视频免费看 | 一区二区三区欧美 | 日韩欧美亚洲 | 中文在线一区二区 | 欧美日韩精品在线免费观看 | 成人福利电影 | 亚洲图片一区二区三区 | 视频精品一区二区三区 | 91九色porny首页最多播放 | 午夜久久久久 | 国产又爽又黄的视频 | 亚洲精品一区二区三区蜜桃久 | 欧美日韩国产一区二区 | 亚洲天堂av网 |