[英]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重新安裝該模塊,但這沒有用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.