Hi all,

I am trying to consume a Pythoncom server from 3ds max. I need this to be
able to call some mysql queries in python script from maxscript. I tried to
follow the steps in this article.

I created a small pythoncom server

import sys, os
def getWorkingDirectory() :
    return os.path.dirname(sys.argv[0])
sys.path.append('tubeBDD')
from Database import Database
import selectBDD as select


db = Database()

# A simple Python COM server.
class PythonComUtilities:
    _public_methods_ = ['getProjects']
    _reg_progid_ = 'PythonCom.Utilities'
    # Class ID must be new/unique for every server you create
    _reg_clsid_ = '{BAC62D37-EEDF-46B3-8DED-11E842225B0E}'


    def getProjects(self, string):
        # self.db = Database()
        projects = select.getProjects(db)
        proj = ""
        for p in projects:
            if proj == "":
                proj = p[0]
            else:
                proj = proj + "," + p[0]
        return proj


if (__name__ == '__main__'):
    print 'Registering COM server...'
    import win32com.server.register as comReg
    comReg.UseCommandLine(PythonComUtilities)

Then I try to call it in a maxscript (in a 3D soft):

comObj = createOLEObject "PythonCom.Utilities"

It gives me this error :

-- Runtime error: createOLEObject: can't create instance PythonCom.Utilities

Any idea what I'm doing wrong ?
Or any idea of how I could test it other than in the 3D soft ?

Cheers,
Johanna
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to