Re: [pyxpcom] communication between firefox and external python program
by Mounir Errami other posts by this author
Jul 6 2008 10:27AM messages near this date
view in the new Beta List Site
Re: [pyxpcom] communication between firefox and external python program
|
[pyxpcom] Python Mozilla extension (pyxpcomext) updated
Atul
thank you. But the solution I am looking for would be packaged and distributed to users: the
python would be packaged as a standalone exe (py2exe) and the firefox part would be an exte
nsion. Ideally users would have to install only these 2.
I Have taken a look at other extensions like MozRepl, or the jsbridge (that is python bridge
to javascript). But after over a day of searching, still can't figure out what to do. And u
sing these seems a lot of investment in terms of effort and time. Not to mention that users,
one way or the other will have to install them and configure etc... So I am looking for som
ething much simpler (that I am sure exist somehow).
Thank you guys for your input. I appreciate it.
M.E.
Date: Sun, 6 Jul 2008 10:12:30 -0700
From: varmaa@[...].com
To: m_errami@[...].com
Subject: Re: [pyxpcom] communication between firefox and external python program
CC: pyxpcom@[...].com
Hi Mounir,
I'm not sure if you're going for a solution that can be packaged as an extension or one that
's more of an in-house/personal solution, but if it's the latter, you might be interested in
a new tool that Mozilla QA is developing called Gristmill. It uses a package called MozRep
l to create a Python-to-Firefox bridge via IPC, and while it's intended for system testing,
it might help you out with what you need to do. You can find out more about it here:
http://wiki.mozilla.org/QA/TDAI/MozMillTestTool
I haven't yet taken the time to investigate it myself, though, so I can't make any predictio
ns on how easy it'll be to get up and running. But if my understanding is correct, this doe
sn't actually require PyXPCOM, as it just connects to a JS-based HTTP server (or something s
imilar) on the Firefox end, and needs only a standard Python distribution on the other end,
which communicates with the HTTP server and marshals/unmarshals data as necessary.
- Atul
On Sun, Jul 6, 2008 at 9:59 AM, MOUNIR ERRAMI <m_errami@[...].com> wrote:
Philip
Thank you for your reply.
1) I am totaling new at XPCOM and and inter-process communication (outside python win32com).
2) I have researching the topic for hours (days) and I am feeling so confused. I just don't
know what is the best way to approach this, and to answer one of your questions, I haven't b
een able to try anything so far.
3) IPC could surely work. But I have couple of issues:
- How do I create a memory bloc on the javascript side (inside firefox)
- How do I identify it
- How do I make my python program aware about it, and listen to it: i.e. set up a reaction w
henever something is written to the memory bloc from inside firefox.
These questions are, I suppose, the very basic in any inter-process communication protocol.
From my research it became obvious that using a file (via XPCOM) as the intermediary is the
easiest but probably not the best (and frankly it seems wrong). The other option was the use
of sockets (again via XPCOM). In both cases it seems possible to identify the object (file
name/location or url+port for sockets). So the python program can be made aware of them. Now
the trick would be to set up the reaction whenever the file is modified or the socket sends
a message.
Again I am very novice. I feel that this problem is simple. Yet the solutions seems a bit co
mplicated to be the correct ones.
Any input is appreciated. Thanks a lot.
M.E.
> From: philip@[...].com
> To: pyxpcom@[...].com
> Date: Sun, 6 Jul 2008 11:06:35 -0400
> Subject: Re: [pyxpcom] communication between firefox and external python program
>
>
> On Jul 5, 2008, at 8:34 PM, MOUNIR ERRAMI wrote:
>
> >
> > All
> > I have a very simple question, yet I can't seem to find an answer,
> > and I don't even think that XPCOM (and PyXPCOM) is it. Is there a
> > way to send information from a firefox extension (i.e in javascript)
> > to an external python program? For instance:
> > 1) in javascript I add a button to a webpage with an eventListener.
> > 2) onclick, some function is called. Ideally this function would
> > send some information (a string)
> > 3) a separate standalone python program (running locally, and that
> > would have nothing to do with firefox) would be listening and would
> > intercept the string and use it and do something with it.
> >
> > I have thought of using sockets, or writing files with javascript
> > etc... But I am unable to find a solution of this problem.
>
>
> Hi Mounir,
> Perhaps telling us what you've tried and why it didn't work would be a
> good start. If you're running code inside a [Py]XPCOM component, I
> don't see any reason why the standard IPC mechanisms wouldn't work.
>
> On a related note, you might be interested in this IPC package for
> Python:
> http://NikitaTheSpider.com/python/shm/
>
> Cheers
> Philip
> _______________________________________________
> pyxpcom mailing list
> pyxpcom@[...].com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
The i'm Talkaton. Can 30-days of conversation change the world? Find out now.
_______________________________________________
pyxpcom mailing list
pyxpcom@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_________________________________________________________________
It�s a talkathon � but it�s not just talk.
http://www.imtalkathon.com/?source=EML_WLH_Talkathon_JustTalk
Thread:
Mounir Errami
Shane Caraveo
Mounir Errami
Mounir Errami
Philip Semanchuk
Mounir Errami
Atul Varma
Mounir Errami
|