obeezzy / lpminimk3

Python API for the Launchpad Mini MK3
https://pypi.org/project/lpminimk3/
MIT License
25 stars 2 forks source link

ValueError: invalid literal for int() with base 10: 'In' #100

Closed bikrdotnet closed 2 years ago

bikrdotnet commented 2 years ago

Attempting to run and getting the following error when executing examples or via shell directly:

Joshs-iMac-Pro:examples josh$ python3
Python 3.8.2 (default, Dec 21 2020, 15:06:04) 
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import lpminimk3
>>> lp = lpminimk3.find_launchpads()[0]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/josh/Library/Python/3.8/lib/python/site-packages/lpminimk3/_lpminimk3.py", line 289, in find_launchpads
    client_number, port_number = SystemMidiPortParser\
  File "/Users/josh/Library/Python/3.8/lib/python/site-packages/lpminimk3/_core/utils.py", line 514, in extract_numbers
    return _UnixMidiPortParser.extract_numbers(system_port_name)
  File "/Users/josh/Library/Python/3.8/lib/python/site-packages/lpminimk3/_core/utils.py", line 532, in extract_numbers
    client_number = int(system_port_name.split(' ')[::-1][0].split(':')[0])
ValueError: invalid literal for int() with base 10: 'In'
bikrdotnet commented 2 years ago

This is running on mac os 12.0.1 Python 3.8.2 (default, Dec 21 2020, 15:06:04) [Clang 12.0.0 (clang-1200.0.32.29)] on darwin

obeezzy commented 2 years ago

@bikrdotnet, thanks for reporting the issue. I've never tested on a Mac, so I suspect that the port names are a little different. Can you send me the output of the following command:

$ python3 -c "import rtmidi; inports=rtmidi.MidiIn().get_ports(); print(f'in={inports}'); outports=rtmidi.MidiOut().get_ports(); print(f'out={
outports}')"
bikrdotnet commented 2 years ago

Joshs-iMac-Pro:examples josh$ python3 -c "import rtmidi; inports=rtmidi.MidiIn().get_ports(); print(f'in={inports}'); outports=rtmidi.MidiOut().get_ports(); print(f'out={

outports}')" File "", line 1 import rtmidi; inports=rtmidi.MidiIn().get_ports(); print(f'in={inports}'); outports=rtmidi.MidiOut().get_ports(); print(f'out={ ^ SyntaxError: EOL while scanning string literal Joshs-iMac-Pro:examples josh$

obeezzy commented 2 years ago

@bikrdotnet, try:

$ python3 -c "import rtmidi; inports=rtmidi.MidiIn().get_ports(); print('in=', inports); outports=rtmidi.MidiOut().get_ports(); print('out=', outports)"
bikrdotnet commented 2 years ago
Joshs-iMac-Pro:examples josh$ python3 -c "import rtmidi; inports=rtmidi.MidiIn().get_ports(); print('in=', inports); outports=rtmidi.MidiOut().get_ports(); print('out=', outports)"
in= ['Launchpad Mini MK3 LPMiniMK3 DAW Out', 'Launchpad Mini MK3 LPMiniMK3 MIDI Out']
out= ['Launchpad Mini MK3 LPMiniMK3 DAW In', 'Launchpad Mini MK3 LPMiniMK3 MIDI In']
Joshs-iMac-Pro:examples josh$ 
obeezzy commented 2 years ago

@bikrdotnet, please try my pull request #101 when you get the chance. You can test it quickly by running the following commands:

$ git pull
$ git checkout add-mac-support
$ PYTHONPATH=. python3 examples/flash.py 

Let me know if it fixes the problem.

bikrdotnet commented 2 years ago

That did it! Thank you!!