Closed xyproto closed 9 years ago
Someone else was writing a plugin in Python, here's the gist they wrote, which they said worked with pie: https://gist.github.com/lonelycode/7983389b305e55da5b27
And here's another one, that the author said he hasn't tested with pie, yet, but "should work": https://bitbucket.org/snippets/ericsnowcurrently/kXe7
I am, unfortunately, not a python guru, so I'm not sure I can help much with the specific python code.
One thing the other guy said was that Go starts its RPC ids at 0, and python started its at 1, which was causing some problems. I noticed your C++ code assumes the first id is 1... which may be the problem.
There's an example python plugin under examples/plugin now. Check it out, maybe that'll help you out.
Just added a Python plugin based on the gist above to the plugins/py
directory in algernon. It worked!
Thanks for adding a python sample, I'll check that out as well.
Awesome! :)
On Fri, Jun 5, 2015 at 10:01 AM Alexander F Rødseth < notifications@github.com> wrote:
Just added a Python plugin based on the gist above to the plugins/py directory in algernon https://github.com/xyproto/algernon. It worked!
Thanks for adding a python sample, I'll check that out as well.
— Reply to this email directly or view it on GitHub https://github.com/natefinch/pie/issues/3#issuecomment-109302884.
Hi,
I'm using pie in Algernon, and it works great for plugins written in Go. However, I'm struggling to communicate with plugins written in Python, C or C++. I have tried sending what I believe to be valid JSON-RPC over stdout (and stderr, for that matter), but I get either no response or error messages about invalid characters.
Here's my latest (failed) attempt in C++11:
(I'm just trying to get any valid reponse at this stage, hence the hardcoded string).
I have tried using Python and several different JSON-RPC modules as well, but with no luck. The Python modules are easy to use for communicating over TCP, but it was surprisingly cumbersome to make them communicate over stdout.
When I test the plugins, I run Algernon in dev mode, like this:
algernon -e
and attempt to call a function like this (in the Lua REPL):CallPlugin("plugins/cpp/main", "hi", "there")
I checked in "plugins/cpp" in the
pie
branch of Algernon, together with a Makefile.Adding examples for how to communicate with pie, for other languages than Go, would be really useful.
While I'm at it, I'm concerned that the way I am passing arguments in the "add3" plugin (written in Go) is sub-optimal, to say the least.
Any advice is appreciated.
Thanks for writing pie!
Best regards, Alexander F Rødseth