0

I'm doing some work with a MIDI controller called the Novation Launchpad that has a python module available to import and use.

My code keeps getting stuck on the line LP = launchpad.Launchpad(). So here is how I've attempted to de-bug:

import launchpad
print "I've started"
LP = launchpad.Launchpad()
LP.Open()
print "I worked!"

The programme never prints I've worked so I know my issue is in the creation of the Launchpad instance.

Using a friends laptop we've had no issues. I've had intermittent issues with it working and not working and really don't even know where to start looking!

amitchone
  • 1,630
  • 3
  • 21
  • 45
  • how do you know it that it is stuck in `LP = launchpad.Launchpad()` and not in `LP.Open()`? – hitzg Apr 24 '15 at 15:52
  • Perhaps you could hit ctrl-C while the program is apparently frozen. If the `launchpad` module is stuck in an infinite loop, the subsequent stack trace could give you a hint as to where the problem lies. This is assuming that you're willing to debug third-party code. – Kevin Apr 24 '15 at 15:52
  • Since I don't know `launchpad` this is only a guess: is `Open()` supposed to access some hardware? Maybe it doesn't find it and is waiting for it to become accessible? – hitzg Apr 24 '15 at 15:54
  • I've also tried without the `LP.Open()` command and that's where it seems to get hung up. Also, the hardware it is using is attached and is recognisable by `pygame.midi` and also various DAWs. I've tried a more complex script using the commands and it has no problems at all, I'm a bit stumped to be honest.. I'll post the script that runs above. – amitchone Apr 24 '15 at 16:02
  • Oh, I've figured it out! Answer to follow: – amitchone Apr 24 '15 at 16:04

1 Answers1

0

So, after finding a programme that would run with those commands, it became clear quickly that I hadn't initiated pygame and pygame.midi.

import pygame, pygame.midi, launchpad

pygame.init()
pygame.midi.init()
print "I've started"
LP = launchpad.Launchpad()
LP.Open()
print "I've worked"

Will run just fine.

amitchone
  • 1,630
  • 3
  • 21
  • 45