Re: [pyxpcom] 'import components' issue with xpcom and python 2.5.1
by Ryan Sturmer other posts by this author
Jul 5 2007 4:40PM messages near this date
view in the new Beta List Site
Re: [pyxpcom] 'import components' issue with xpcom and python 2.5.1
|
Re: [pyxpcom] 'import components' issue with xpcom and python 2.5.1
Well again, the XULRunner app works! I set up my directory structure, with
a toplevel app directory/chrome, components, etc... just the way the
tutorials describe, and everything works great.... it's when I try to import
the python xpcom libraries interactively though, ie: "from xpcom import
components" that I have the resolution issue...
I've added as many conceivable paths to my PYTHONPATH as I can imagine, as
well as started my interactive python shell from a myriad of different
locations with no luck
Is there any better material regarding how to get started with this stuff,
than the sparse examples I've found already? Maybe this isn't the
technology to be using if it's falling into disservice?
I guess if I stick with it... are there any diagnostic tools I can pick up
to ease my headaches? Right now I'm limited to taking my one simple
XULrunner example, and sort of permuting it to do different stuff, using
javascript alerts as my primary source of debug statements (bleck!)
I guess even beyond that, does anyone have any suggestions regarding
mozconfig files I can use to build the trunk to give me the appropriate
suite of tools for developing a standalone XUL application? (a la songbird,
etc...) I could post mine, if that's informative.
So many questions, sorry to sort of fork the topic of this thread.
-R
On 7/5/07, Shane Caraveo <shanec@[...].com> wrote:
>
> I have patches for xulrunner/trunk, but must get into a meeting, ping me
> later/tomorrow.
> Shane
>
> Mark Hammond wrote:
> >>From memory, trying to use a XULRunner build in this way is tricky, due
> to
> > the directory layout used by that tech. It might be necessary to dig
> into
> > _xpcom.cpp to see exactly what directory we are calling NS_InitXPCOM2()
> > with, and if that directory is appropriate for a xulrunner app.
> >
> > Mark
> > -----Original Message-----
> > From: pyxpcom-bounces@[...].com
> > [mailto:pyxpcom-bounces@[...].com]On Behalf Of Ryan
> Sturmer
> > Sent: Friday, 6 July 2007 6:17 AM
> > To: pyxpcom@[...].com
> > Subject: [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\compon
> > ents.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\shutdo
> > wn.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\shutdo
> > wn.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\compon
> > ents.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\compon
> > ents.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/
> >
> > _______________________________________________
> > pyxpcom mailing list
> > pyxpcom@[...].com
> > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>
--
"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
|