[python-win32] problem After compiling with py2exe on a com class

Mark Hammond skippy.hammond at gmail.com
Tue Jul 17 03:19:22 CEST 2012


On 17/07/2012 8:37 AM, Matteo Boscolo wrote:
> Hi all,
>
> I got a com server that is crated inside a cad application.
>
> if i run the following code(That is a method of my com class):
>
> def showWindows(self):
>          """
>              show a qt windows with a button
>          """
>          try:
>              logging.info("showWindows .....")
>              nDocument=str(self.td.Documents.Count)
>              form=EditInputBox(nDocument) # <-- this is a pyqt dialog
>              form.exec_()
>              logging.info("After Exec %s"%str(self.td.Documents.Count))
>              return S_OK
>          except:
>              print_exc_plus()
>              return 1
>
> and I'm using the normal python source script, all work ok.
>
> but if I py2exe the com server,( .exe )

When you run it from normal Python, is the .exe or .dll version of the 
object used?  Depending on the creator of the object, the default is 
likely to be the inproc (ie, dll) version.  You should verify this and 
ensure py2exe creates the same kind of server.

Apart from that, I'm afraid I have no idea...

HTH,

Mark


  and i run the some code, and I
> leave the dialog opened for more than a minute I got the following
> exception from the self.td.Documents.Count that is a method of the cad
> application.
>
> It seems a problem releted to a timeout or releted to the garbage
> collector.
> Any Idea in how to debug it or how to find a solution to this problem is
> really appreciated.
>
> regards
> Matteo
>
>
> ERROR:root:********************
> ERROR:root:<class 'pywintypes.com_error'>
> ERROR:root:(-2147417856, 'System call failed.', None, None)
> ERROR:root:<traceback object at 0x027CBF58>
> ERROR:root:********************
> ERROR:root:Locals by frame, innermost last
> ERROR:root:Frame <module> in boot_com_servers.py at line 112
> ERROR:root:             get_classes = <function get_classes at 0x02C134F0>
> ERROR:root:     DllUnregisterServer = <function DllUnregisterServer at
> 0x02D5C470>
> ERROR:root:                     arg = /automate
> ERROR:root:                  clsids =
> ['{1E685399-2991-4E3D-8217-22DE9CFBEAF6}']
> ERROR:root:             __package__ = None
> ERROR:root:        com_module_names = ['testCom']
> ERROR:root:                 __doc__ = None
> ERROR:root:          zipextimporter = <module 'zipextimporter' from
> 'C:\d\OMNIAS~1\PROGRA~1\ECLIPS~1\ALLPUR~1\THINKD~1\TestCom\dist\testCom.exe\zipextimporter.pyc'>
>
> ERROR:root:            __builtins__ = <module '__builtin__' (built-in)>
> ERROR:root:                     sys = <module 'sys' (built-in)>
> ERROR:root:                __name__ = __main__
> ERROR:root:             com_modules = [<module 'testCom' from
> 'C:\d\OMNIAS~1\PROGRA~1\ECLIPS~1\ALLPUR~1\THINKD~1\TestCom\dist\testCom.exe\testCom.pyc'>]
>
> ERROR:root:       DllRegisterServer = <function DllRegisterServer at
> 0x02D5C330>
> ERROR:root:                       i = 1
> ERROR:root:                       k = <class 'testCom.TestComInterface'>
> ERROR:root:                       m = <module 'testCom' from
> 'C:\d\OMNIAS~1\PROGRA~1\ECLIPS~1\ALLPUR~1\THINKD~1\TestCom\dist\testCom.exe\testCom.pyc'>
>
> ERROR:root:              DllInstall = <function DllInstall at 0x02D5C4B0>
> ERROR:root:                win32com = <module 'win32com' from
> 'C:\d\OMNIAS~1\PROGRA~1\ECLIPS~1\ALLPUR~1\THINKD~1\TestCom\dist\testCom.exe\win32com\__init__.pyc'>
>
> ERROR:root:               pythoncom = <module 'pythoncom' from
> 'C:\d\OMNIAS~1\PROGRA~1\ECLIPS~1\ALLPUR~1\THINKD~1\TestCom\dist\testCom.exe\pythoncom27.dll'>
>
> ERROR:root:                win32api = <module 'win32api' from
> 'C:\d\OMNIAS~1\PROGRA~1\ECLIPS~1\ALLPUR~1\THINKD~1\TestCom\dist\testCom.exe\win32api.pyd'>
>
> ERROR:root:Frame serve in win32com\server\localserver.pyc at line 36
> ERROR:root:                   infos = [(<PyIClassFactory at 0x02E9E4B8
> with obj at 0x02F43B08>, 16)]
> ERROR:root:                  clsids =
> ['{1E685399-2991-4E3D-8217-22DE9CFBEAF6}']
> ERROR:root:Frame _Invoke_ in win32com\server\policy.pyc at line 277
> ERROR:root:                  wFlags = 3
> ERROR:root:                    args = ()
> ERROR:root:                    lcid = 0
> ERROR:root:                  dispid = 1001
> ERROR:root:                    self =
> <win32com.server.policy.DesignatedWrapPolicy instance at 0x02EEE2B0>
> ERROR:root:Frame _invoke_ in win32com\server\policy.pyc at line 282
> ERROR:root:                  wFlags = 3
> ERROR:root:                    args = ()
> ERROR:root:                    lcid = 0
> ERROR:root:                  dispid = 1001
> ERROR:root:                    self =
> <win32com.server.policy.DesignatedWrapPolicy instance at 0x02EEE2B0>
> ERROR:root:Frame _invokeex_ in win32com\server\policy.pyc at line 585
> ERROR:root:         serviceProvider = None
> ERROR:root:                    self =
> <win32com.server.policy.DesignatedWrapPolicy instance at 0x02EEE2B0>
> ERROR:root:                    args = ()
> ERROR:root:                  dispid = 1001
> ERROR:root:                funcname = showWindows
> ERROR:root:                  wFlags = 3
> ERROR:root:                    lcid = 0
> ERROR:root:                    func = <bound method
> TestComInterface.showWindows of <testCom.TestComInterface object at
> 0x02D72810>>
> ERROR:root:                  kwArgs = None
> ERROR:root:Frame showWindows in testCom.pyc at line 133
> ERROR:root:                    self = <testCom.TestComInterface object
> at 0x02D72810>
> ERROR:root:               nDocument = 1
> ERROR:root:                    form = <testCom.EditInputBox object at
> 0x05482588>
> ERROR:root:Frame __getattr__ in win32com\client\__init__.pyc at line 466
> ERROR:root:                    self = <win32com.gen_py.think3
> thinkdesign Type Library.IApplication instance at 0x49209832>
> ERROR:root:                    args = (11, 2, (9, 0), (), 'Documents',
> '{91D219D5-0F56-11D3-BD73-00500400405B}')
> ERROR:root:                    attr = Documents
> ERROR:root:Frame _ApplyTypes_ in win32com\client\__init__.pyc at line 459
> ERROR:root:             resultCLSID =
> {91D219D5-0F56-11D3-BD73-00500400405B}
> ERROR:root:                  dispid = 11
> ERROR:root:                    self = <win32com.gen_py.think3
> thinkdesign Type Library.IApplication instance at 0x49209832>
> ERROR:root:                    args = ()
> ERROR:root:                 retType = (9, 0)
> ERROR:root:                argTypes = ()
> ERROR:root:                  wFlags = 2
> ERROR:root:                    user = Documents
>
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32



More information about the python-win32 mailing list