ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> pyxpcom
pyxpcom
Re: [pyxpcom] 'import components' issue with xpcom and python 2.5.1
by Shane Caraveo other posts by this author
Jul 5 2007 3:58PM 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
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
_______________________________________________
pyxpcom mailing list
pyxpcom@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Ryan Sturmer
Mark Hammond
Shane Caraveo
Ryan Sturmer
Mark Hammond
Ryan Sturmer

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved