繁体   English   中英

PySimpleDMX不知道自己的课

[英]PySimpleDMX doesn't know own class

我一直在尝试使此模块正常工作,但由于某种原因,它似乎不知道自己的类

这是我的代码:

    import pysimpledmx

    mydmx = pysimpledmx.DMXConnection(3)

这是我需要从PySimpleDMX获得的代码:

    class DMXConnection(object):
      def __init__(self, comport = None):
        '''
        On Windows, the only argument is the port number. On *nix, it's the path to the serial device.
        For example:
            DMXConnection(4)              # Windows
            DMXConnection('/dev/tty2')    # Linux
            DMXConnection("/dev/ttyUSB0") # Linux
        '''
        self.dmx_frame = [0] * DMX_SIZE
        try:
          self.com = serial.Serial(comport, baudrate = COM_BAUD, timeout = COM_TIMEOUT)
        except:
          com_name = 'COM%s' % (comport + 1) if type(comport) == int else comport
          print "Could not open device %s. Quitting application." % com_name
          sys.exit(0)

        print "Opened %s." % (self.com.portstr)

我要使用DMXConnection时收到的错误:

AttributeError: module 'pysimpledmx' has no attribute 'DMXConnection'

但是如您所见,DMXConnection是pysimpledmx的属性。 我试图用PIP重新安装该模块,但这没有用。

那是一个废弃的Python 2软件包,要么安装它并与Python 2版本一起使用,要么将模块文件复制您的项目中并尝试对其进行调试。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM