I am having the following problem setting up PyXPCom to work with
firefox  1.5.0.2 (Deer Park) on Linux FC3.

I cannot instantiate pyXPCOM components, the createInstance() fails
when attempting to instantiate a pyXPCOM component. I think it would be
best to describe the problem by pasting the output from the python
interpreter session.

[EMAIL PROTECTED] bin]# python
Python 2.3.4 (#1, Oct 26 2004, 16:42:40)
[GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from xpcom import components
Type Manifest File:
/opt/spikesetup/install/firefox/lib/firefox-1.5.0.2/components/xpti.dat
>>> file_cls = components.classes["@mozilla.org/file/local;1"]
>>> file_obj = file_cls.createInstance(components.interfaces.nsILocalFile)
>>> print file_obj
<XPCOM component '@mozilla.org/file/local;1' (with no class info)>
>>> test_cls = components.classes["@mozilla.org/pySimple;1"]
>>> test_obj = test_cls.createInstance(components.interfaces.nsIPySimple)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File
"/opt/spikesetup/install/firefox/lib/python2.4/site-packages/xpcom/components.py",
line 191, in createInstance
    raise xpcom.COMException(details.errno, "No such component '%s'" %
(self.contractid,))
xpcom.Exception: 0x80040154 (No such component
'@mozilla.org/pySimple;1')
>>> test_obj = test_cls.createInstance()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File
"/opt/spikesetup/install/firefox/lib/python2.4/site-packages/xpcom/components.py",
line 191, in createInstance
    raise xpcom.COMException(details.errno, "No such component '%s'" %
(self.contractid,))
xpcom.Exception: 0x80040154 (No such component
'@mozilla.org/pySimple;1')

The pySimple XPCOM component is taken from the examples in the Mozilla
Developers website example at the following link:

http://developer.mozilla.org/en/docs/Creating_a_Python_XPCOM_component

>From the output above it is clear I can instantiate and use C++ XPCOM
components, but not PyXPCOM components. I have the 2 files related to
the pySimple XPCOM component (py_simple.py and py_simple.xpt) in the
"components" directory and they have been registered. I can see
entries in xpti.dat related to nsIPySimple interface.

I get the following error message related to PyXPCOM in the firefox
browser's startup:

Could not import the Python XPCOM extension
exceptions.ImportError:
/opt/spikesetup/install/firefox/lib/python2.4/site-packages/xpcom/_xpcom.so:
undefined symbol: openpty

I have tried debugging this in eclipse and it appears that the
GetComponentManager() call in xpcom/client/__init__() fails.

Looking into the source for _xpcom.so, (file xpcom.cpp, method
PyXPCOMMethod_GetComponentManager) it appears that
NS_GetComponentManager is failing.

Debugging into this further gives me the impression the crux of the
problem is PyImport_ImportModule in PyLoader.cpp line 182 is failing to
load the xpcom._xpcom module. I have verified that xpcom directory is
in sys.path, have also tried copying the xpcom directory into
site-packages directory of the python installation.

I would greatly appreciate any pointers into what I need to do to get
this working.

Thanks in advance,

-alex

_______________________________________________
dev-tech-xpcom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xpcom

Reply via email to