traitsui and pythoncom

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

traitsui and pythoncom

Jordan Ilott
Hi all,

I'm trying to build a COM server which uses traitsui. I'm using pywin32 to do this but I'm not having any success. No matter what I do, I seem to be unable to include any traits imports without a crash. The traceback is pasted below. I've tried setting the toolkit to wx, qt and null. I've had no success. Any help would be much appreciated. Thanks.

Object with win32trace dispatcher created (object=None)
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\win32com\server\dispatcher.py", line 34, in _CreateInstance_
    self.policy._CreateInstance_(clsid, reqIID)
  File "C:\Python27\lib\site-packages\win32com\server\policy.py", line 194, in _CreateInstance_
    myob = call_func(classSpec)
  File "C:\Python27\lib\site-packages\win32com\server\policy.py", line 727, in call_func
    return resolve_func(spec)(*args)
  File "C:\Python27\lib\site-packages\win32com\server\policy.py", line 716, in resolve_func
    module = _import_module(mname)
  File "C:\Python27\lib\site-packages\win32com\server\policy.py", line 735, in _import_module
    __import__(mname)
  File "C:\Users\user\Documents\Active Work\Trending\code\ChacoCOM\COM_Trend.py", line 17, in <module>
    from model.data_frame_plot_data_model import DataFramePlotDataModel
  File "C:\Users\user\Documents\Active Work\Trending\code\ChacoCOM\model\data_frame_plot_data_model.py", line 4, in <module>
    from chaco.api import AbstractPlotData, AbstractDataSource
  File "C:\Python27\lib\site-packages\chaco\api.py", line 37, in <module>
    from abstract_plot_renderer import AbstractPlotRenderer
  File "C:\Python27\lib\site-packages\chaco\abstract_plot_renderer.py", line 7, in <module>
    from plot_component import PlotComponent
  File "C:\Python27\lib\site-packages\chaco\plot_component.py", line 4, in <module>
    from enable.api import Component
  File "C:\Python27\lib\site-packages\enable\api.py", line 8, in <module>
    from base import IDroppedOnHandler, TOP, VCENTER, BOTTOM, LEFT, HCENTER, RIGHT, \
  File "C:\Python27\lib\site-packages\enable\base.py", line 35, in <module>
    from colors import color_table, transparent_color
  File "C:\Python27\lib\site-packages\enable\colors.py", line 178, in <module>
    import wx
  File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\__init__.py", line 45, in <module>
    from wx._core import *
  File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 4, in <module>
    import _core_
ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.
pythoncom error: ERROR: server.policy could not create an instance.

Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\win32com\server\policy.py", line 136, in CreateInstance
    return retObj._CreateInstance_(clsid, reqIID)
  File "C:\Python27\lib\site-packages\win32com\server\dispatcher.py", line 37, in _CreateInstance_
    return self._HandleException_()
  File "C:\Python27\lib\site-packages\win32com\server\dispatcher.py", line 34, in _CreateInstance_
    self.policy._CreateInstance_(clsid, reqIID)
  File "C:\Python27\lib\site-packages\win32com\server\policy.py", line 194, in _CreateInstance_
    myob = call_func(classSpec)
  File "C:\Python27\lib\site-packages\win32com\server\policy.py", line 727, in call_func
    return resolve_func(spec)(*args)
  File "C:\Python27\lib\site-packages\win32com\server\policy.py", line 716, in resolve_func
    module = _import_module(mname)
  File "C:\Python27\lib\site-packages\win32com\server\policy.py", line 735, in _import_module
    __import__(mname)
  File "C:\Users\user\Documents\Active Work\Trending\code\ChacoCOM\COM_Trend.py", line 17, in <module>
    from model.data_frame_plot_data_model import DataFramePlotDataModel
  File "C:\Users\user\Documents\Active Work\Trending\code\ChacoCOM\model\data_frame_plot_data_model.py", line 4, in <module>
    from chaco.api import AbstractPlotData, AbstractDataSource
  File "C:\Python27\lib\site-packages\chaco\api.py", line 37, in <module>
    from abstract_plot_renderer import AbstractPlotRenderer
  File "C:\Python27\lib\site-packages\chaco\abstract_plot_renderer.py", line 7, in <module>
    from plot_component import PlotComponent
  File "C:\Python27\lib\site-packages\chaco\plot_component.py", line 4, in <module>
    from enable.api import Component
  File "C:\Python27\lib\site-packages\enable\api.py", line 8, in <module>
    from base import IDroppedOnHandler, TOP, VCENTER, BOTTOM, LEFT, HCENTER, RIGHT, \
  File "C:\Python27\lib\site-packages\enable\base.py", line 35, in <module>
    from colors import color_table, transparent_color
  File "C:\Python27\lib\site-packages\enable\colors.py", line 178, in <module>
    import wx
  File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\__init__.py", line 45, in <module>
    from wx._core import *
  File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 4, in <module>
    import _core_
ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.
pythoncom error: Unexpected gateway error

Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\win32com\server\policy.py", line 136, in CreateInstance
    return retObj._CreateInstance_(clsid, reqIID)
  File "C:\Python27\lib\site-packages\win32com\server\dispatcher.py", line 37, in _CreateInstance_
    return self._HandleException_()
  File "C:\Python27\lib\site-packages\win32com\server\dispatcher.py", line 34, in _CreateInstance_
    self.policy._CreateInstance_(clsid, reqIID)
  File "C:\Python27\lib\site-packages\win32com\server\policy.py", line 194, in _CreateInstance_
    myob = call_func(classSpec)
  File "C:\Python27\lib\site-packages\win32com\server\policy.py", line 727, in call_func
    return resolve_func(spec)(*args)
  File "C:\Python27\lib\site-packages\win32com\server\policy.py", line 716, in resolve_func
    module = _import_module(mname)
  File "C:\Python27\lib\site-packages\win32com\server\policy.py", line 735, in _import_module
    __import__(mname)
  File "C:\Users\user\Documents\Active Work\Trending\code\ChacoCOM\COM_Trend.py", line 17, in <module>
    from model.data_frame_plot_data_model import DataFramePlotDataModel
  File "C:\Users\user\Documents\Active Work\Trending\code\ChacoCOM\model\data_frame_plot_data_model.py", line 4, in <module>
    from chaco.api import AbstractPlotData, AbstractDataSource
  File "C:\Python27\lib\site-packages\chaco\api.py", line 37, in <module>
    from abstract_plot_renderer import AbstractPlotRenderer
  File "C:\Python27\lib\site-packages\chaco\abstract_plot_renderer.py", line 7, in <module>
    from plot_component import PlotComponent
  File "C:\Python27\lib\site-packages\chaco\plot_component.py", line 4, in <module>
    from enable.api import Component
  File "C:\Python27\lib\site-packages\enable\api.py", line 8, in <module>
    from base import IDroppedOnHandler, TOP, VCENTER, BOTTOM, LEFT, HCENTER, RIGHT, \
  File "C:\Python27\lib\site-packages\enable\base.py", line 35, in <module>
    from colors import color_table, transparent_color
  File "C:\Python27\lib\site-packages\enable\colors.py", line 178, in <module>
    import wx
  File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\__init__.py", line 45, in <module>
    from wx._core import *
  File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 4, in <module>
    import _core_
ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.
pythoncom error: CPyFactory::CreateInstance failed to create instance. (80004005)

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: traitsui and pythoncom

Jordan Ilott
Some additional information:

I've found that for a simple traitsui editor(say for a string attribute) I can call edit_traits() and a new window appears and allows me to edit the simple attributes. This was without trying to set the toolkit.
 
If I try to choose a tool kit at the beginning of my code(before all other imports) I get that I posted previously, regardless of the toolkit. My goal is actually to show a Chaco plot and when I import even a datasource I end up with the error I posted.

Jordan

On Wed, Mar 27, 2013 at 2:20 PM, Jordan Ilott <[hidden email]> wrote:
Hi all,

I'm trying to build a COM server which uses traitsui. I'm using pywin32 to do this but I'm not having any success. No matter what I do, I seem to be unable to include any traits imports without a crash. The traceback is pasted below. I've tried setting the toolkit to wx, qt and null. I've had no success. Any help would be much appreciated. Thanks.

Object with win32trace dispatcher created (object=None)
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\win32com\server\dispatcher.py", line 34, in _CreateInstance_
    self.policy._CreateInstance_(clsid, reqIID)
  File "C:\Python27\lib\site-packages\win32com\server\policy.py", line 194, in _CreateInstance_
    myob = call_func(classSpec)
  File "C:\Python27\lib\site-packages\win32com\server\policy.py", line 727, in call_func
    return resolve_func(spec)(*args)
  File "C:\Python27\lib\site-packages\win32com\server\policy.py", line 716, in resolve_func
    module = _import_module(mname)
  File "C:\Python27\lib\site-packages\win32com\server\policy.py", line 735, in _import_module
    __import__(mname)
  File "C:\Users\user\Documents\Active Work\Trending\code\ChacoCOM\COM_Trend.py", line 17, in <module>
    from model.data_frame_plot_data_model import DataFramePlotDataModel
  File "C:\Users\user\Documents\Active Work\Trending\code\ChacoCOM\model\data_frame_plot_data_model.py", line 4, in <module>
    from chaco.api import AbstractPlotData, AbstractDataSource
  File "C:\Python27\lib\site-packages\chaco\api.py", line 37, in <module>
    from abstract_plot_renderer import AbstractPlotRenderer
  File "C:\Python27\lib\site-packages\chaco\abstract_plot_renderer.py", line 7, in <module>
    from plot_component import PlotComponent
  File "C:\Python27\lib\site-packages\chaco\plot_component.py", line 4, in <module>
    from enable.api import Component
  File "C:\Python27\lib\site-packages\enable\api.py", line 8, in <module>
    from base import IDroppedOnHandler, TOP, VCENTER, BOTTOM, LEFT, HCENTER, RIGHT, \
  File "C:\Python27\lib\site-packages\enable\base.py", line 35, in <module>
    from colors import color_table, transparent_color
  File "C:\Python27\lib\site-packages\enable\colors.py", line 178, in <module>
    import wx
  File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\__init__.py", line 45, in <module>
    from wx._core import *
  File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 4, in <module>
    import _core_
ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.
pythoncom error: ERROR: server.policy could not create an instance.

Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\win32com\server\policy.py", line 136, in CreateInstance
    return retObj._CreateInstance_(clsid, reqIID)
  File "C:\Python27\lib\site-packages\win32com\server\dispatcher.py", line 37, in _CreateInstance_
    return self._HandleException_()
  File "C:\Python27\lib\site-packages\win32com\server\dispatcher.py", line 34, in _CreateInstance_
    self.policy._CreateInstance_(clsid, reqIID)
  File "C:\Python27\lib\site-packages\win32com\server\policy.py", line 194, in _CreateInstance_
    myob = call_func(classSpec)
  File "C:\Python27\lib\site-packages\win32com\server\policy.py", line 727, in call_func
    return resolve_func(spec)(*args)
  File "C:\Python27\lib\site-packages\win32com\server\policy.py", line 716, in resolve_func
    module = _import_module(mname)
  File "C:\Python27\lib\site-packages\win32com\server\policy.py", line 735, in _import_module
    __import__(mname)
  File "C:\Users\user\Documents\Active Work\Trending\code\ChacoCOM\COM_Trend.py", line 17, in <module>
    from model.data_frame_plot_data_model import DataFramePlotDataModel
  File "C:\Users\user\Documents\Active Work\Trending\code\ChacoCOM\model\data_frame_plot_data_model.py", line 4, in <module>
    from chaco.api import AbstractPlotData, AbstractDataSource
  File "C:\Python27\lib\site-packages\chaco\api.py", line 37, in <module>
    from abstract_plot_renderer import AbstractPlotRenderer
  File "C:\Python27\lib\site-packages\chaco\abstract_plot_renderer.py", line 7, in <module>
    from plot_component import PlotComponent
  File "C:\Python27\lib\site-packages\chaco\plot_component.py", line 4, in <module>
    from enable.api import Component
  File "C:\Python27\lib\site-packages\enable\api.py", line 8, in <module>
    from base import IDroppedOnHandler, TOP, VCENTER, BOTTOM, LEFT, HCENTER, RIGHT, \
  File "C:\Python27\lib\site-packages\enable\base.py", line 35, in <module>
    from colors import color_table, transparent_color
  File "C:\Python27\lib\site-packages\enable\colors.py", line 178, in <module>
    import wx
  File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\__init__.py", line 45, in <module>
    from wx._core import *
  File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 4, in <module>
    import _core_
ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.
pythoncom error: Unexpected gateway error

Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\win32com\server\policy.py", line 136, in CreateInstance
    return retObj._CreateInstance_(clsid, reqIID)
  File "C:\Python27\lib\site-packages\win32com\server\dispatcher.py", line 37, in _CreateInstance_
    return self._HandleException_()
  File "C:\Python27\lib\site-packages\win32com\server\dispatcher.py", line 34, in _CreateInstance_
    self.policy._CreateInstance_(clsid, reqIID)
  File "C:\Python27\lib\site-packages\win32com\server\policy.py", line 194, in _CreateInstance_
    myob = call_func(classSpec)
  File "C:\Python27\lib\site-packages\win32com\server\policy.py", line 727, in call_func
    return resolve_func(spec)(*args)
  File "C:\Python27\lib\site-packages\win32com\server\policy.py", line 716, in resolve_func
    module = _import_module(mname)
  File "C:\Python27\lib\site-packages\win32com\server\policy.py", line 735, in _import_module
    __import__(mname)
  File "C:\Users\user\Documents\Active Work\Trending\code\ChacoCOM\COM_Trend.py", line 17, in <module>
    from model.data_frame_plot_data_model import DataFramePlotDataModel
  File "C:\Users\user\Documents\Active Work\Trending\code\ChacoCOM\model\data_frame_plot_data_model.py", line 4, in <module>
    from chaco.api import AbstractPlotData, AbstractDataSource
  File "C:\Python27\lib\site-packages\chaco\api.py", line 37, in <module>
    from abstract_plot_renderer import AbstractPlotRenderer
  File "C:\Python27\lib\site-packages\chaco\abstract_plot_renderer.py", line 7, in <module>
    from plot_component import PlotComponent
  File "C:\Python27\lib\site-packages\chaco\plot_component.py", line 4, in <module>
    from enable.api import Component
  File "C:\Python27\lib\site-packages\enable\api.py", line 8, in <module>
    from base import IDroppedOnHandler, TOP, VCENTER, BOTTOM, LEFT, HCENTER, RIGHT, \
  File "C:\Python27\lib\site-packages\enable\base.py", line 35, in <module>
    from colors import color_table, transparent_color
  File "C:\Python27\lib\site-packages\enable\colors.py", line 178, in <module>
    import wx
  File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\__init__.py", line 45, in <module>
    from wx._core import *
  File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 4, in <module>
    import _core_
ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.
pythoncom error: CPyFactory::CreateInstance failed to create instance. (80004005)


_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev