久久久久久久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>
                            主站蜘蛛池模板: 国产精品国产三级国产aⅴ中文 | 国产亚洲人成a在线v网站 | 在线视频一区二区 | 手机看黄av免费网址 | 影视一区 | 日韩av成人在线观看 | 日本三级电影免费 | 91在线精品秘密一区二区 | 欧美精品一二三 | 五月婷婷中文 | 亚洲欧美视频一区 | 成人国产在线视频 | 午夜精品视频 | 日本特黄a级高清免费大片 成年人黄色小视频 | 羞羞在线观看视频 | 精品蜜桃一区二区三区 | 黄色大片免费观看 | 91久久久久久久久久久久久 | 久久成人一区 | 欧美激情精品久久久久 | 99视频网| 国产视频久久 | 中文字幕一区二区三区不卡在线 | 日韩在线播放中文字幕 | 亚洲一区二区在线 | 精品国产99 | 精品真实国产乱文在线 | 北条麻妃国产九九九精品小说 | 国内精品免费久久久久软件老师 | 日批免费看 | 高清一区二区三区 | 超碰在线播 | 日韩福利 | 99久久中文字幕三级久久日本 | 精品免费国产一区二区三区四区介绍 | www午夜视频 | 蜜桃精品视频在线 | 亚洲人成人网 | 久久精品国产一区 | www97影院 | 日韩精品极品视频在线观看免费 |