Fun with new python plugin.
In a startup script; initalize oddly named python and DotNet controls and data classes.
Write short script with simple UI with dotnet / MSX elements, data storage and malipulation using Dotnet data classes, python file access and MaxScript for Node access. Written with minimal line documentation.
Hand to co-worker asking what’s wrong… ha ha ha…
Hi,
Again thanks ehulser for sharing the dlx. I’m having the same problem like what cgBartosz has encountered.
I’m currently running python 2.5.1.
It seems like you can import all the built in modules without any error within max. But when you try to import other library it just return undefined as thou it can’t find the path.
However within python there’s no problem importing using:
>>> import sys
>>> print sys.version
2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)]
>>> import os
>>> os
<module ‘os’ from ‘C:\Python25\lib\os.pyc’>
Thanks again for sharing :).
Ok i have tried with python 2.4.4 and it seems to work fine now without any problem on importing modules.
I guess that the current python plugins is not compatible with 2.5.1. With 2.5.1 the sys version will always revert back to the built-in version which is 2.4.3 (#69) instead of the following result that i’m getting from max with 2.4.4.
sys = python.import "sys"
<module 'sys' (built-in)>
sys.version
"2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)]"
os = python.import "os"
<module 'os' from 'C:\Python24\Lib\os.py'>
Not sure if i’m right on this. Hope it helps on anyone else having the same problem. But at least i get to start working on more python tools.
This probably has to do with the plugin being compiled with Python 2.4 libs. Thats the version we’re running and the code was compiled for – do you have both python versions installed? Try flushing the sys.path variable to remap to c:/Python25 instead of 24
which reminds me – I still haven’t mapped setting attributes…will have to get on that…
for instance, cant do this:
sys = python.import “sys”
sys.path = #() – That’ll crash…though it shouldn’t
I have both 2.5.1 and 2.4.4 installed. And yup can’t really remap for now as it will just return
-- Unknown property: "path" in <module 'sys' (built-in)>
I was trying to use MySQLdb module with blurPython in max. But seems like the connection string can’t map correctly yet too. Just to let you know before hand
This works in python IDLE
import MySQLdb
MySQLdb.connect(host="localhost",user="root",passwd="Mypassword",db="MyDB")
while this doesn’t in maxscript
pysql = python.import "MySQLdb"
<module 'MySQLdb' from 'C:\Python24\lib\site-packages\MySQLdb\__init__.pyc'>
pysql.connect
<function Connect at 0x103E0030>
conn = pysql.connect(host="localhost",user="root",passwd="Mypassword",db="MyDB")
-- Syntax error: at ),, expected <factor>
-- In line: conn = pysql.connect(host="localhost",u
Not sure if i’m doing something wrong thou.
Yeah MySQLdb was the big reason I wanted python integration more seamless without using ODBC and OLE.
Hi Guys,
Having had just returned from holidays this is awesome, I definitely have to shout Eric some beers! awesome work! I have only had a quick chance to play with it so far but it looks very impressive… A quick question, what is the likely hood of a 64bit build?
Again thanks to Eric and blur for sharing this with us for those of us who have large and complex python based pipelines this will be fantastic to better integrate max… Thanks to Paul for hosting as well!
Cheers
Dave