Debugging Python within Ableton Live
Asked Answered
K

6

14

How can I see script errors for my python MIDI Remote Scripts in Ableton Live? I've seen references online to a hidden Python console, but no documentation on how to open it, if it would even help me!

Currently I type code, reload the script, and see what happens. If nothing happens, then something is wrong. Very tedious...

Edit: I should also point out that there isn't anything useful in the Log.txt file either, yet that file is being updated.

Karnak answered 26/10, 2010 at 1:17 Comment(3)
I am awarding the bounty to slomojo, as it might as well go to someone for their efforts. Please though, if you know how to get that console up, post the answer here.Karnak
I'll get my Ableton setup running again and try and find it.Responsive
Thanks slomojo! If you have any ideas on how I could search for it, I'd dig too. I just don't have a clue. I know almost nothing of Python. I'm typically a .NET guy. Thanks again.Karnak
S
4

To debug the control surface, you can define your own log method like so:

def log(self, message):
    sys.stderr.write("LOG: " + message.encode("utf-8"))

Usage example:

year = 1999
self.log("I'm gonna party like it's " + str(year))

This will append

21179419 ms. RemoteScriptError: LOG: Tonight I'm gonna party like it's 1999

to your Log.txt.

Also, it may be worth knowing that (at least as of Live 9.1) edited control surface files are recompiled every time you load a new song, no need to restart the application.

EDIT: changed the stderr write method so that it doesn't write two lines and an extra return for every log

Silicosis answered 16/7, 2016 at 13:45 Comment(2)
By load a new song, you mean new Live project, right?Karnak
Correct, a new Live set/project.Silicosis
N
4

I use the log.txt for a ton of debugging. It is a little hard to read, but here's my tips.

log writes top down (new info is on next line) and records all the events, more or less.

If you get an error you will get a large hex looking block - about 20+ lines looking like this:

280 ms. Exception: 0x00495580:0x00000000

Right above that block is the error or what may have thrown the script in the Ableton run time.

As you travel UP from that exception you will see something like a trace.

also - you can use :

self.log_message("STUFF")

to write into the log (there are other methods).

I have seen some log file parsers (real time) in my work. Not tried them yet.

Hope that hleps a little. O was ablt to write a PHP app for the python (yeah, sinful I know). http://modrn.dj/app

Nyberg answered 10/2, 2012 at 5:14 Comment(0)
S
4

For the sake of completeness: on Mac OS X 10.9, the Log.txt file is in

/Users/-username-/Library/Preferences/Ableton/Live 9.1/

The Live 9.1 folder may of course be different for different versions of Live.

Note the Library folder is hidden. It took me a while to figure that out. An easy way to access it with Finder: click the Go menu item, then hold Alt and the Library folder will pop into the menu

Silicosis answered 17/1, 2014 at 15:40 Comment(0)
S
4

To debug the control surface, you can define your own log method like so:

def log(self, message):
    sys.stderr.write("LOG: " + message.encode("utf-8"))

Usage example:

year = 1999
self.log("I'm gonna party like it's " + str(year))

This will append

21179419 ms. RemoteScriptError: LOG: Tonight I'm gonna party like it's 1999

to your Log.txt.

Also, it may be worth knowing that (at least as of Live 9.1) edited control surface files are recompiled every time you load a new song, no need to restart the application.

EDIT: changed the stderr write method so that it doesn't write two lines and an extra return for every log

Silicosis answered 16/7, 2016 at 13:45 Comment(2)
By load a new song, you mean new Live project, right?Karnak
Correct, a new Live set/project.Silicosis
N
2

what about http://remotescripts.blogspot.com/2010_03_01_archive.html

Neuropathy answered 1/10, 2012 at 2:24 Comment(0)
I
1

This has certainly changed over the years with different versions of Ableton Live.

I'm running Live 8 and first tried to get the LiveAPI stuff to spit out debug information: http://post.monome.org/comments.php?DiscussionID=4607&page=1

I started with an older version that didn't work with OSX, reported here: http://code.google.com/p/liveapi/issues/detail?id=4 I don't think the new version includes the telnet console.

SO, the best answer is to find a log file here, which contains debug information on a problematic MIDI Remote Scripts:

Library/Preferences/Ableton/Live 8.2.1/Log.txt

Ivatts answered 18/6, 2011 at 18:7 Comment(0)
E
0

You can also use http://julienbayle.net/ableton-live-9-midi-remote-scripts for Ableton Live 9

Endomorphism answered 6/3, 2013 at 14:8 Comment(4)
Thanks for the link, but this does not answer my question at all. I was interested in debugging my own scripts.Karnak
I still didn't upload that part.Endomorphism
I still didn't upload that part. There is a file named Log.txt in /Users/<username>/Library/Preferences/Ableton/Live x x x/ There are ALL debugging info of Live. If you want to debug your python via the Framework log_message method, you can use something like self.log_message() ... That should answer..Endomorphism
Could you edit your answer to contain this information? We prefer answers to stand on their own, and not require people to visit another site. This makes it easier to find a solution, and protects against link rot (which is a serious issue as the site grows older).Cutwork

© 2022 - 2024 — McMap. All rights reserved.