How to call a pythonScript and pass arguments to this?

How to call a pythonScript and pass arguments to this?

Anonymous
Not applicable
1,930 Views
2 Replies
Message 1 of 3

How to call a pythonScript and pass arguments to this?

Anonymous
Not applicable

Hello there,

 

I have a .py file that I want to call from maxScript. The pythonscript is supposed to do some operations on an external file and I wrote it to take 4 arguments (argv) when executing it. It works fine when starting it from the commandline, but how do I pass those 4 argument when using "python.ExecuteFile()" within a mxsFile?

 

 

 

Thanks,

Martin

0 Likes
1,931 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

I don't know how to do this exactly, but just to throw some ideas:

 

I assume maxscript and python work with 2 different compilers so you need to set the arguments in a "neutral" space that both compiles can read. I tried making a global variable in maxscript and reading from python, but it didn't work. 

 

Either:

write to a text file (or memory?) like here:

http://tech-artists.org/forum/showthread.php?5310-3dsmax-2015-Pass-arguments-from-MAXScript-to-Pytho...

 

Or write a .net object that lives in both worlds(?)

 

Or have a look at Duber

http://python.duber.cz/documentation/

 

Didn't test any of this but I hope it helps.

Message 3 of 3

Anonymous
Not applicable

Hi glBeatriz,

 

thanks for your support. I did not find any way to pass argvs but i solved it by writing a file with the values per mxs and read those in the pyScript first. Its a little workaround but works well... I'll check the links for new ideas!

 

Best,

Martin

 

 

P.S: I cannot use the commandline since python is not installed on all the workstations here, so I have to call the script from max.

0 Likes