hdavid / Launchpad95

Improved Novation Launchpad scripts for Ableton Live
http://motscousus.com/stuff/2011-07_Novation_Launchpad_Ableton_Live_Scripts/
GNU General Public License v3.0
352 stars 82 forks source link

changed Settings imports, added product id for Launchpad Mini #64

Closed rest4rt closed 3 years ago

rest4rt commented 3 years ago

The scripts were failing on Ableton Live 9 Suite (9.5 Build: 2015-10-20) with error:

3270 ms. RemoteScriptError: from .Settings import *

3270 ms. RemoteScriptError: SyntaxError
3270 ms. RemoteScriptError: :
3270 ms. RemoteScriptError: 'import *' not allowed with 'from .'
3270 ms. RemoteScriptError:

I've replaced all the places where it occurred in the source files, some of them already had the correct from .Settings import Settings.

In the process of trying to figure out why Launchpad95 wasn't showing in my Control Surfaces list I noticed the product id for my Launchpad Mini wasn't included, so I've added it for completeness. Screen Shot 2021-04-07 at 1 12 40 PM

My editor made a couple of extra trailing whitespace changes, feel free to ignore them.

(and possibly not the place for this, but thanks for the amazing scripts!)

hdavid commented 3 years ago

oh WOW ! a PR ! thanks for that. i will have a look, because the import changes were for python3 in live11. i will try to make them compatible with both. i will test with live 11 and 9 and see how it goes! thank you so much

hdavid commented 3 years ago

Hi @rest4rt i cannot test with live9. it crashes on big sur (or my mac anyways...). Could you give it a try and confirm it works if you rewrite the Settings imports like so ?

try:
    from .Settings import *
except ImportError:
    from .Settings import Settings

or

try:
    from .Settings import *
except SyntaxError:
    from .Settings import Settings
rest4rt commented 3 years ago

That didn't work for me, it fails with a SyntaxError even if I changed the order to

try:
    from .Settings import Settings
except ImportError:
    from .Settings import *

This did work for me:

try:
    from .Settings import Settings
except ImportError:
    exec("from .Settings import *")

And I confirmed exec("from .Settings import Settings") works, so hopefully if it was failing for you with an ImportError you can catch it with:

try:
    exec("from .Settings import Settings")
except ImportError:
    exec("from .Settings import *")

or use

try:
    exec("from .Settings import *")
except SyntaxError:
    from .Settings import Settings 

(both confirmed to work for me)

Let me know if any of those work for you and which one you prefer and I'll apply it to all the files and push again

hdavid commented 3 years ago

indeed this works in live 11 and 10!

try:
    exec("from .Settings import Settings")
except ImportError:
    exec("from .Settings import *")

thanks a lot for giving it a go. as soon as you update the PR i will merge it and update the dist on my site :)

rest4rt commented 3 years ago

Done! I just pushed into the same branch again and it looks like it got automatically added to the pull request, I think that's all that's needed? It's my first pull request ever, so sorry for any of the things that I didn't get right!

And thanks again for the quick response and amazing scripts, my launchpad had been collecting dust for a while and this is exactly what it needed to come back to life

hdavid commented 3 years ago

thanks a lot :) i am so happy the script works for 9, 10 and 11 :)