getting python to work in max 5

Jan 18, 2009 at 10:51pm

getting python to work in max 5

#41831
Jan 19, 2009 at 12:31am

#149147
Jan 19, 2009 at 2:45am

#149148
Jan 19, 2009 at 7:53am

#149149
Jan 19, 2009 at 8:08am

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.

#149150
Jan 19, 2009 at 11:31am

#149151
Jan 19, 2009 at 12:00pm

Take a look at the jython bindings as well:

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

#149152
Jan 19, 2009 at 1:10pm

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

#149153
Jan 19, 2009 at 3:40pm

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.

#149154
Jan 19, 2009 at 4:43pm

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

Looking forward to Jython 2.5 !

#149155
Jan 19, 2009 at 5:20pm

#149156
Jan 19, 2009 at 9:31pm

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)

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

#149157
Jan 20, 2009 at 1:34am

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

#149158
Feb 9, 2009 at 7:58pm

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

#149159
Jan 5, 2010 at 8:37pm

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

#149160
Jan 5, 2010 at 9:42pm

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.

#149161
Jan 6, 2010 at 12:08pm

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.)

#149162
Jan 8, 2010 at 12:54am

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…

#149163

You must be logged in to reply to this topic.