Arguments in Jython

Daan Adriaan's icon

Hi guys,

I'm trying to call a .py file and give 2 arguments. Normally in terminal this would go with the command ./libreimport.py daanm exported_tracks.txt

I send a message "script libreimport" to the object "mxj net.loadbang.jython.mxj.ScriptEngine @script libreimport" but I don't know what the hell I'm doing. It seems to recognise the file though. I don't know much about javascript and the use of Jython and I hope to find an easy and quick solution. Anybody a hint?

Thanks in advance!

nick rothwell | project cassiel's icon

The Jython object is written in Java, not Javascript, but in most applications that doesn't matter; you'll just be writing Python.

You can pass arguments using @args ... in the object box, or you can load a script containing a function foo and then send in a message foo arg1 arg2 ... to call that function with arguments.

There should be examples showing all of this at https://github.com/cassiel/net.loadbang.jython/tree/master/examples - the patchers there were written in Max 4 but still work in Max 7.

to_the_sun's icon

How exactly would I use jython.BasicUsage.mxt from the examples you link to? What is a mxt file and how do I open it?