简体   繁体   中英

PySimpleDMX doesn't know own class

I've been trying to get this module working but for some reason it looks like it doesn't know its own classes

This is my code:

    import pysimpledmx

    mydmx = pysimpledmx.DMXConnection(3)

This is the code I need to get from 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)

The error I get when i want to use the DMXConnection:

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

But as you can see, DMXConnection is an attribute of pysimpledmx. I've tried to reinstall the module with PIP, but that didn't work.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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