• <bdo id='B7CwM'></bdo><ul id='B7CwM'></ul>
    <legend id='B7CwM'><style id='B7CwM'><dir id='B7CwM'><q id='B7CwM'></q></dir></style></legend>

    1. <small id='B7CwM'></small><noframes id='B7CwM'>

      <i id='B7CwM'><tr id='B7CwM'><dt id='B7CwM'><q id='B7CwM'><span id='B7CwM'><b id='B7CwM'><form id='B7CwM'><ins id='B7CwM'></ins><ul id='B7CwM'></ul><sub id='B7CwM'></sub></form><legend id='B7CwM'></legend><bdo id='B7CwM'><pre id='B7CwM'><center id='B7CwM'></center></pre></bdo></b><th id='B7CwM'></th></span></q></dt></tr></i><div id='B7CwM'><tfoot id='B7CwM'></tfoot><dl id='B7CwM'><fieldset id='B7CwM'></fieldset></dl></div>

      <tfoot id='B7CwM'></tfoot>

        尝试在 WinXP 上使用 pyserial 打开串行端口 -&gt;“拒绝访问"

        Trying to open a serial port with pyserial on WinXP -gt; quot;Access deniedquot;(尝试在 WinXP 上使用 pyserial 打开串行端口 -gt;“拒绝访问)

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

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

              <tbody id='FNTG0'></tbody>

                • <bdo id='FNTG0'></bdo><ul id='FNTG0'></ul>
                  本文介绍了尝试在 WinXP 上使用 pyserial 打开串行端口 -&gt;“拒绝访问"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试使用 python 和 pyserial 通过串行端口将数据发送到 hplc 泵.我在 linux(gentoo 衍生产品)下测试了电缆和泵,尽管它是 root 用户,但它工作得很好.现在我必须在 WinXP 机器上使用代码,在尝试打开端口时总是出现拒绝访问"错误(我将参数调整为 COMxx 而不是 ttySxx,找到了端口).我试过电脑的串口,还有一个USB2Serial适配器.我听说 WinXP 在尝试使用自写代码解决某些端口时非常严格.有没有比安装 linux 更简单的解决方法?

                  I'm trying to send data to an hplc pump via the serial port using python and pyserial. I tested the cable and the pump under linux (a gentoo derivative), where it worked perfectly, albeit as root. Now i have to use the code on a WinXP machine, where i always get an "Access denied" error when trying to open the port (i adjusted the parameters to COMxx instead of ttySxx, the port is found). I tried the serial port of the computer, as well as a USB2Serial adapter. I heard that WinXP was quite restrictive when it comes to trying to address some port with self written code. Is there a simpler workaround for this problem than installing linux?

                  # -*- coding: utf-8 -*-
                  
                  import sys
                  import time
                  import serial
                  from threading import Thread
                  
                  """
                  usage: cmdCapture workDirectory pictureTime pressureTime
                  """
                  
                  print 'successful import is successful'
                  
                  workDir=sys.argv[1]
                  pressureThresh=float(sys.argv[3])
                  
                  class doCapture(Thread):
                  def __init__ (self, workDir, pressureThresh):
                      Thread.__init__(self)
                  
                      self.workDir=workDir
                      self.pressureThresh=pressureThresh
                      self.pressureTimer=0
                  

                  ->这里我设置了串口

                      self.ser=serial.Serial(port='\.COM1', baudrate=9600, bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, timeout=1)
                  

                  ->这里发生错误

                      self.ser.open()
                  
                  def getPressure(self):
                      self.ser.write('PR')
                      return self.ser.read(size=8), timer.timer()
                  
                  def run(self):
                      self.pressureTimer=time.timer()
                      while 1:
                          if self.pressureTimer<=(time.timer()-self.pressureTime):
                              self.p=getPressure()
                              print self.p
                  
                  myCapture=doCapture(workDir, pressureThresh)
                  myCapture.start()
                  

                  推荐答案

                  尝试打开端口为\.COMxx

                  还要确保端口尚未从其他应用程序打开.我建议你使用超级终端查看端口是否打开.

                  Also make sure that the port isn't already open from another application. I recommend that you use Hyperterminal to see if the port is open.

                  这篇关于尝试在 WinXP 上使用 pyserial 打开串行端口 -&gt;“拒绝访问"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Pythonic and efficient way of finding adjacent cells in grid(在网格中查找相邻单元格的 Pythonic 和有效方法)
                  map a hexagonal grid in matplotlib(在 matplotlib 中映射六边形网格)
                  Execute arbitrary python code remotely - can it be done?(远程执行任意 python 代码 - 可以吗?)
                  Python - Plotting colored grid based on values(Python - 根据值绘制彩色网格)
                  Is there a GUI design app for the Tkinter / grid geometry?(是否有 Tkinter/网格几何图形的 GUI 设计应用程序?)
                  tkinter Canvas Scrollbar with Grid?(带有网格的 tkinter 画布滚动条?)

                    <i id='HbC8v'><tr id='HbC8v'><dt id='HbC8v'><q id='HbC8v'><span id='HbC8v'><b id='HbC8v'><form id='HbC8v'><ins id='HbC8v'></ins><ul id='HbC8v'></ul><sub id='HbC8v'></sub></form><legend id='HbC8v'></legend><bdo id='HbC8v'><pre id='HbC8v'><center id='HbC8v'></center></pre></bdo></b><th id='HbC8v'></th></span></q></dt></tr></i><div id='HbC8v'><tfoot id='HbC8v'></tfoot><dl id='HbC8v'><fieldset id='HbC8v'></fieldset></dl></div>
                    • <bdo id='HbC8v'></bdo><ul id='HbC8v'></ul>
                        • <tfoot id='HbC8v'></tfoot>
                            <tbody id='HbC8v'></tbody>

                            <legend id='HbC8v'><style id='HbC8v'><dir id='HbC8v'><q id='HbC8v'></q></dir></style></legend>

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