[pyxpcom] 'import components' issue with xpcom and python 2.5.1
by Ryan Sturmer other posts by this author
Jul 5 2007 1:17PM messages near this date
view in the new Beta List Site
Re: [pyxpcom] Is it possible to override AddRef / Release for a PyXPCOMcomponent?
|
Re: [pyxpcom] 'import components' issue with xpcom and python 2.5.1
I'm working on windows, and I've got an import problem,
when I call:
from xpcom import components
I get an error:
C:\Documents and Settings\rsturmer\My Documents\src\<ipython console> in
<module> ()
C:\mozilla-src-vc71\mozilla\obj-i686-pc-mingw32\dist\bin\python\xpcom\components.py
in <module> ()
229
230 # import xpcom.shutdown late as it depends on us!
--> 231 import shutdown
232 shutdown.register(_on_shutdown)
233
C:\mozilla-src-vc71\mozilla\obj-i686-pc-mingw32\dist\bin\python\xpcom\shutdown.py
in <module> ()
49 _handlers = []
50
---> 51 class _ShutdownObserver:
52 _com_interfaces_ = interfaces.nsIObserver
53 def observe(self, service, topic, extra):
C:\mozilla-src-vc71\mozilla\obj-i686-pc-mingw32\dist\bin\python\xpcom\shutdown.py
in _ShutdownObserver()
50
51 class _ShutdownObserver:
---> 52 _com_interfaces_ = interfaces.nsIObserver
53 def observe(self, service, topic, extra):
54 logger = logging.getLogger('xpcom')
C:\mozilla-src-vc71\mozilla\obj-i686-pc-mingw32\dist\bin\python\xpcom\components.py
in __getattr__(self, attr)
101 if self._dict_data is not None and
self._dict_data.has_key(attr):
102 return self._dict_data[attr]
--> 103 return self._get_one(attr)
104 def __getitem__(self, item):
105 if self._dict_data is not None and
self._dict_data.has_key(item):
C:\mozilla-src-vc71\mozilla\obj-i686-pc-mingw32\dist\bin\python\xpcom\components.py
in _get_one(self, name)
151 # Present a better exception message, and give a more
useful error code.
152 import nsError
--> 153 raise xpcom.COMException(nsError.NS_ERROR_NO_INTERFACE,
"The interface '%s' does not exist" % (name,))
154 return _Interface(item.GetName(), item.GetIID())
155
<class 'xpcom.Exception'> : -2147467262 (-2147467262)
It apparently can't find the interface.... I went into the /dist/bin/python
directory, (I'm using the latest trunk, as of a week or so ago) and mucked
about with the source a bit (just put some debug print statements in there)
The interface it can't find is the nsIObserver, which makes me think maybe
python simply can't find the component registry? I've made sure that
/dist/bin and /dist/bin/python are on my path... it doesn't have any
(apparent) issue finding xpcom.dll and its kin, but I get this import error
everytime I try to do anything.
The odd thing is, I've successfully built an example program with xulrunner,
where I have a button that when pressed, calls out to an xpcom component
written in python, that returns a random number that's displayed with a
javascript alert....that component calls the same import, but when executed,
apparently doesn't give me any trouble, because it performs its intended
function.
It's obnoxious not to be able to work these things interactively from within
the python shell. Any clues?
--
"The preceding program contained violent scenes of a graphic nature. Time
travelers with nervous dispositions may wish to listen to something else for
the past half hour."
-John Marsh
"The Hitchhikers Guide to the Galaxy"
Ryan Sturmer
ryansturmer@[...].com
http://www.gogglemarks.net/
Thread:
Ryan Sturmer
Mark Hammond
Shane Caraveo
Ryan Sturmer
Mark Hammond
Ryan Sturmer
|