Forums > MaxMSP

getting python to work in max 5

January 18, 2009 | 10:51 pm


January 19, 2009 | 12:31 am


January 19, 2009 | 2:45 am


January 19, 2009 | 7:53 am


January 19, 2009 | 8:08 am

Hi !

I’m currently working with Python for symbolic processes. You only
have the "py.mxo" external. "pyext" is just another name and you just
have to declare its objectmapping in the text file "max-
objectmappings.txt":
max objectfile pyext py;

Then it should simply work. If not, tell me. I have recompiled it for
the mac version.

ps : I’m still on OS10.4.11 (I know… :)); I have replaced the
current OSX python version to Python 2.6.1 (r261:67515) with no problem.


January 19, 2009 | 11:31 am


January 19, 2009 | 12:00 pm

Take a look at the jython bindings as well:

http://www.loadbang.net/space/Software/net.loadbang.jython


January 19, 2009 | 1:10 pm

On 19 Jan 2009, at 12:00, Stephen Lumenta wrote:

> Take a look at the jython bindings as well:
>
> http://www.loadbang.net/space/Software/net.loadbang.jython

Cheers – I was going to suggest going via Jython. Downside: still at
Python 2.2 (I’m currently experimenting with the Jython 2.5 release).
Upside: all of Java available, including networking and access to (for
example) XML libraries. Upside #2: completely portable between Mac and
Windows, works identically on Max 4 and Max 5.

– N.

Nick Rothwell / Cassiel.com Limited
http://www.cassiel.com
http://www.myspace.com/cassieldotcom
http://www.last.fm/music/cassiel
http://www.reverbnation.com/cassiel
http://www.linkedin.com/in/cassiel
http://www.loadbang.net


January 19, 2009 | 3:40 pm

aha, thanks I will try that and see if that was the problem when I’m
behind my machine again…
not sure for now whether that looks like the error I got, however…

thanks,

Joost.

On Jan 19, 2009, at 9:08 AM, olivier pasquet wrote:

> Hi !
>
> I’m currently working with Python for symbolic processes. You only
> have the "py.mxo" external. "pyext" is just another name and you
> just have to declare its objectmapping in the text file "max-
> objectmappings.txt":
> max objectfile pyext py;
>
> Then it should simply work. If not, tell me. I have recompiled it
> for the mac version.
>
> ps : I’m still on OS10.4.11 (I know… :)); I have replaced the
> current OSX python version to Python 2.6.1 (r261:67515) with no
> problem.



Nat
January 19, 2009 | 4:43 pm

I have used Jython within max and it works great ! Much easier than the other implementation.

Looking forward to Jython 2.5 !


January 19, 2009 | 5:20 pm


January 19, 2009 | 9:31 pm

Hi Olivier,

behind my machine, changed the max-objectmappings as instructed and
bang, this error:

2009-01-19 22:24:02.432 MaxMSP[6001] CFLog (21): Error loading /
Applications/Max5/Cycling ’74/max-externals/py.mxo/Contents/MacOS/
py: error code 4, error number 0 (Symbol not found:
_LSGetApplicationForItem
Referenced from: /Applications/Max5/Cycling ’74/max-externals/
py.mxo/Contents/MacOS/py
Expected in: /System/Library/Frameworks/CoreServices.framework/
Versions/A/CoreServices
)

it shows that it does try to load py.mxo, but there is some
incompatibility with it.
Also when I looked at my previous error, it was identical, so the
objectmapping was not the problem (I do recall installing a python-
objectmappings file).
Can you perhaps send me the recompiled version (or point me to an
explanation how to recompile myself) ?
I’m still on os10.4.11 too, but that will change soon.
I installed python 2.5.4 to be sure that some of my extra modules
work properly (numpy, scipy, sympy, brian).

I am still exploring possibillities for a project, so I might try the
Jython route too: it seems better supported from my first impression..

thanks !

Joost.

On 19 Jan, 2009, at 9:08 AM, olivier pasquet wrote:

> Hi !
>
> I’m currently working with Python for symbolic processes. You only
> have the "py.mxo" external. "pyext" is just another name and you
> just have to declare its objectmapping in the text file "max-
> objectmappings.txt":
> max objectfile pyext py;
>
> Then it should simply work. If not, tell me. I have recompiled it
> for the mac version.
>
> ps : I’m still on OS10.4.11 (I know… :)); I have replaced the
> current OSX python version to Python 2.6.1 (r261:67515) with no
> problem.

——————————————-

Joost Rekveld
———– http://www.lumen.nu/rekveld

——————————————-

"In theory, there is no difference between theory and practice.
In practice, there is."

(Jan L. A. van de Snepscheut)

——————————————-


January 20, 2009 | 1:34 am

Hi,

OOps, I did not see you had this error message on your previous
email. Indeed, that simply means you do not have the right py.mxo
version.
Jython seems very good too but different.

You need flext to recompile it. Here is the binary external (82 Kb –
available for 7 days):

http://www.yousendit.com/download/WnBTb2VKY3kzMW1Ga1E9PQ

best,

O



Nat
February 9, 2009 | 7:58 pm

Olivier, could you please repost this ?
Thanks a lot !


January 5, 2010 | 8:37 pm

Hi, jython implementation works great. I’m using it for a project since 2 months. But as my python codes grows in size, it seems that it can’t load properly class files that is compiled and that weight more than 90ko.
here’s what it says
"java.lang.ClassFormatError: java.lang.ClassFormatError: Invalid method Code length 71421 in class file CLASS_losemanfra$py"

Did anyone experienced this kind of issue?

Gus


January 5, 2010 | 9:42 pm

Re, I made some search and it seems that’s because of the 64k method size limitation of JVM.
The only way is to make methods that’s smaller than 64k once compiled.


January 6, 2010 | 12:08 pm

Oh – interesting. I didn’t know about that. Do you have the faulty code? I might punt it at the Jython mailing list. (I also need to update the Jython release I’m using; it’s a beta release.)


January 8, 2010 | 12:54 am

Hi, there is no faulty code.
For my project, I have 2 python files.
The first one is the one I load with "mxj net.loadbang.jython.mxj.ScriptEngine" object.
This file calls a python class which is my second file.
In my class, I have methods. If one of them is too long (the code is ui scripting, so there’s lots of code) then the max message window warn us with this message: "java.lang.ClassFormatError: java.lang.ClassFormatError: Invalid method Code length 71421 in class file CLASS_losemanfra$py". Means that the method is too long. But fortunately the class file can be more than 64k, it’s just the method that can’t.

It seems to be a java limitation, people in forums says that it is not necessarly a disadvantage for it forces us to write more modulable code…


Viewing 18 posts - 1 through 18 (of 18 total)