FMMT666 / launchpad.py

Novation Launchpad (and Midi Fighter) control suite for Python
Other
355 stars 63 forks source link

AttributeError: "NoneType" object has no attribute "write_sys_ex" (Launchpad MK2) #58

Closed Ari24-cb24 closed 4 years ago

Ari24-cb24 commented 4 years ago

Hey I just started with LaunchpadPy and my MK2 but an exception appeared:

Traceback (most recent call last):
  File "C:/Users/bobmy/OneDrive/Desktop/pp/┌ Other/LaunchpadPygame/Main.py", line 4, in <module>
    lp.LedAllOn(colorcode=0xffffff)
  File "C:\Users\bobmy\AppData\Local\Programs\Python\Python37\lib\site-packages\launchpad_py\launchpad.py", line 1289, in LedAllOn
    self.midi.RawWriteSysEx( [ 0, 32, 41, 2, 24, 14, colorcode ] )
  File "C:\Users\bobmy\AppData\Local\Programs\Python\Python37\lib\site-packages\launchpad_py\launchpad.py", line 167, in RawWriteSysEx
    self.devOut.write_sys_ex( timeStamp, array.array('B', [0xf0] + lstMessage + [0xf7] ).tostring() )
AttributeError: 'NoneType' object has no attribute 'write_sys_ex'

Process finished with exit code 1`

I just tested some methods like

import launchpad_py

lp = launchpad_py.LaunchpadMk2()
lp.ButtonFlush()

or


import launchpad_py

lp = launchpad_py.LaunchpadMk2()
lp.LedAllOn()

But the same error appears and appears with the "NoneType" object

Hope u can help me

Greets and sorry for my bad english skills

FMMT666 commented 4 years ago

You need to "open" the device first, e.g.:

import launchpad

lp = launchpad.LaunchpadMk2()
lp.Open(0)
...

Currently busy, sorry for just posting the link to some examples here: https://github.com/FMMT666/launchpad.py/tree/master/examples

FMMT666 commented 4 years ago

Let me know if you still have issues ...

Ari24-cb24 commented 4 years ago

Hey there, Works fine now, but please mention that method in the exception.

Greets!