Trouble getting Python for .NET to work in Ableton Live

Hi group, I'm new here, so let me start with a small introduction: I'm a Progress developer (RDBMS with it's own 4GL) for a living, with some experience in C++ and C#, and I'm into music. Python is new to me, but doesn't seem so hard to learn (at least the basics). So sorry beforehand for some silly questions which I should have posted at a Python noob forum ;) Here's the question: The provided examples with Python for .NET run fine with the supplied python.exe on my Win32 XP SP2. I previously had problems with using the CLR.dll (Python .NET 1.0) inside a default Python 2.4.4 installation, and asked Brian Lloyd about this, but it was apparently an installation problem; now, on another machine, this imports fine (import CLR). It was a Python 2.5.1 installation on the other machine, maybe that's the difference. What I'd really like to do however, is the following: In a music program called Ableton Live, Python scripts are used to make interfaces between hardware midi controllers and Ableton Live. I'd like to use Python for .NET here, since I have several C# libraries I'd like to use for my mappings (and other stuff). When I copy "Python.Runtime.dll" and "CLR.dll" to a subfolder with a python script of Ableton Live, it compiles into .pyc. Ableton Live however gives a message "A serious error has occured", and on shutdown of the program, a memory fault causes the MS debugger to launch. Not good. Is what I want possible? Should I add more code to the .py scripts? The only thing I've added was "import CLR" in the first line of "__init__.py" (plus a newline character oc). Should I use a CLR.dll for Python 2.2, and does that exist? With the Python for .NET 2.0, I don't see a CLR.dll anymore. Only a "clr.so" of which I have no clue, and doesn't import. How should I use it? Here is some more info on Ableton Live's Python implementation (quoted from www.liveapi.org, which is down at the moment): # The current limitations that really stand out are: Ableton's Python environment is based on a stripped down Python 2.2 install # Updates are limited to 60ms (16 times a second) # Threads in Ableton's Python environment are only polled every 100ms, sys.setcheckinterval() doesn't seem to affect this. # No select.py seems to work, although we suspect that this could be easily resolved with some additional effort. There's an incompatibility between Ableton's Python and the 'standard' Python 2.2 major release. They appear to be different flavors. Any help appreciated, Kind regards, Tijs Wickardt

Python 2.2 is a seriously old version of Python. There's no download of Python.NET for Python 2.2 that I can see. You'd have to compile that yourself, and I don't even know what version of Visual C++ was used to compile Python 2.2 for Windows. Maybe the best solution at this point would be to use the popen2 module to spawn your Python.NET-using scripts as subprocesses, and communicate with your Ableton Live scripts using lines of strings. Cheers, Feihong Tijs Wickardt <wickardt@xs4all.nl> wrote: Hi group, I'm new here, so let me start with a small introduction: I'm a Progress developer (RDBMS with it's own 4GL) for a living, with some experience in C++ and C#, and I'm into music. Python is new to me, but doesn't seem so hard to learn (at least the basics). So sorry beforehand for some silly questions which I should have posted at a Python noob forum ;) Here's the question: The provided examples with Python for .NET run fine with the supplied python.exe on my Win32 XP SP2. I previously had problems with using the CLR.dll (Python .NET 1.0) inside a default Python 2.4.4 installation, and asked Brian Lloyd about this, but it was apparently an installation problem; now, on another machine, this imports fine (import CLR). It was a Python 2.5.1 installation on the other machine, maybe that's the difference. What I'd really like to do however, is the following: In a music program called Ableton Live, Python scripts are used to make interfaces between hardware midi controllers and Ableton Live. I'd like to use Python for .NET here, since I have several C# libraries I'd like to use for my mappings (and other stuff). When I copy "Python.Runtime.dll" and "CLR.dll" to a subfolder with a python script of Ableton Live, it compiles into .pyc. Ableton Live however gives a message "A serious error has occured", and on shutdown of the program, a memory fault causes the MS debugger to launch. Not good. Is what I want possible? Should I add more code to the .py scripts? The only thing I've added was "import CLR" in the first line of "__init__.py" (plus a newline character oc). Should I use a CLR.dll for Python 2.2, and does that exist? With the Python for .NET 2.0, I don't see a CLR.dll anymore. Only a "clr.so" of which I have no clue, and doesn't import. How should I use it? Here is some more info on Ableton Live's Python implementation (quoted from www.liveapi.org, which is down at the moment): # The current limitations that really stand out are: Ableton's Python environment is based on a stripped down Python 2.2 install # Updates are limited to 60ms (16 times a second) # Threads in Ableton's Python environment are only polled every 100ms, sys.setcheckinterval() doesn't seem to affect this. # No select.py seems to work, although we suspect that this could be easily resolved with some additional effort. There's an incompatibility between Ableton's Python and the 'standard' Python 2.2 major release. They appear to be different flavors. Any help appreciated, Kind regards, Tijs Wickardt _________________________________________________ Python.NET mailing list - PythonDotNet@python.org http://mail.python.org/mailman/listinfo/pythondotnet --------------------------------- Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.

Feihong Hsu wrote:
Python 2.2 is a seriously old version of Python. There's no download of Python.NET for Python 2.2 that I can see. You'd have to compile that yourself, and I don't even know what version of Visual C++ was used to compile Python 2.2 for Windows. Maybe the best solution at this point would be to use the popen2 module to spawn your Python.NET-using scripts as subprocesses, and communicate with your Ableton Live scripts using lines of strings.
Python Dot NET doesn't support Python 2.2. It hardly supports 2.3 and 2.4. I keep 2.4 support around because Zope still uses 2.4. And I only added support to 2.3 because somebody asked me very nicely and the change to the code was was trivial. However 2.2 is a no go for me. The API and ABI changes between 2.2 and 2.3 an too great and 2.2 is *really* old. Christian

Not sure how insane this is, but if you want to really roll your sleeves up you might be able to checkout the old python2.2-supporting branch of python.net and build it using the .NET 2.x tool chain. If it works (no guarantees, but it might), then you should at least be able to load .net 2.x assemblies, though you wouldn't be able to leverage features that were supported in .net 1.0. I don't know much about Ableton (I'm a Sonar guy...), but if they haven't done anything too weird to the python they ship with you could also investigate dropping in a newer python exe, dlls and libs... -Brian On 12/12/07 12:30 PM, "Christian Heimes" <lists@cheimes.de> wrote:
Feihong Hsu wrote:
Python 2.2 is a seriously old version of Python. There's no download of Python.NET for Python 2.2 that I can see. You'd have to compile that yourself, and I don't even know what version of Visual C++ was used to compile Python 2.2 for Windows. Maybe the best solution at this point would be to use the popen2 module to spawn your Python.NET-using scripts as subprocesses, and communicate with your Ableton Live scripts using lines of strings.
Python Dot NET doesn't support Python 2.2. It hardly supports 2.3 and 2.4. I keep 2.4 support around because Zope still uses 2.4. And I only added support to 2.3 because somebody asked me very nicely and the change to the code was was trivial.
However 2.2 is a no go for me. The API and ABI changes between 2.2 and 2.3 an too great and 2.2 is *really* old.
Christian
_________________________________________________ Python.NET mailing list - PythonDotNet@python.org http://mail.python.org/mailman/listinfo/pythondotnet
-------------------------- Brian Lloyd brian.lloyd@revolutionhealth.com
participants (4)
-
Brian Lloyd
-
Christian Heimes
-
Feihong Hsu
-
Tijs Wickardt