Debugging Python within Ableton Live
How can I see script errors for my python MIDI Remote Scripts in Ableton Live? I've seen r开发者_Python百科eferences 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.
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
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
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
what about http://remotescripts.blogspot.com/2010_03_01_archive.html
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
You can also use http://julienbayle.net/ableton-live-9-midi-remote-scripts for Ableton Live 9
精彩评论