kilon alios wrote:
Hi there, I promised to do this a long time ago, but since you asked it
I done it now.
So as Ben said I am the author of Ephestos, a communication bridge
between Blender and Pharo .
To go directly to the how to . Ephestos is basically a socket bridge
that send via sockets strings from pharo to python that then python
executes as python commands.
Ephestos is made so it works inside blender but I promised Atals a spin
off project that allows the same socket bridge to be used as a
standalone. To use do the following.
1) Get Ephestos , you can find it and install it with the configuration
browser in your image in Pharo 3 and Pharo 4. Make sure you have a
recent release though because I added it recently.
2) Get pyAtlas , this is the python side , you can get it from here
--> https://github.com/kilon/pyAtlas
3) in your command line cd to the pyAtlas directory and execute :
python3 pyAtlas.py
4) in Pharo you can now try any python code you want
for example
Ephestos sendMessage: 'print("hello world")'.
Ephestos sendMessage: 'x = 3'.
x := Ephestos getValue: 'x'.
x inspect.
Ephestos sendMessage: string, basically sends the python command to be
executes while getValue: sends the command and returns a value as a string.
you can use string 'exit' to close the socket bridge but this part is
buggy as it seems to keep the binding of the sokcet active and I have to
wait to clean it up in macos to reopen the bridge.
You can also use pharo syntax and python errors will trigger the pharo
debugger with a title the python error itself.
You can find more information about Ephestos in my gitbook that can be
read here
https://www.gitbook.io/book/kilon/ephestos
Also I forgot to add that sendMessage can send multiline strings , so
its possible to send python class definitions and other stuff, you type
the string exactly as you would type python code respecting whitespaces.
If you want to execute loads of lines of python code then it would be
better to put your code in a python module and do
Ephestos sendMessage: 'import mymodule'
assuming your module is called 'mymodule' , python import basically are
executions of code.
If you have any questions just ask.
Bare in mind this is a socket bridge so its not ideal for sending
thousands of messages per second and you may run into the occasional bug
or two which I will fix if you report it. Nonetheless it should allow
you to execute any kind of code and not just call python functions or
python methods.
On Thu, Sep 25, 2014 at 7:40 PM, Ben Coman <b...@openinworld.com
<mailto:b...@openinworld.com>> wrote:
__
Pablo R. Digonzelli wrote:
Hi all , I need to invoke python rutines from Pharo. I need some
orientation about the best way to do it.
TIA
****
------------------------------------------------------------------------
*Ing. Pablo Digonzelli*
Software Solutions
IP-Solutiones SRL
Metrotec SRL
25 de Mayo 521
Email: pdigonze...@softsargentina.com
<mailto:pdigonze...@softsargentina.com>
pdigonze...@gmail.com <mailto:pdigonze...@gmail.com>
Cel: 5493815982714
Search the [pharo-dev] list for Ephestos by kilon.
cheers -ben
I was going to say... "invoking python from Pharo" with Ephestos/Atlas
would make a good chapter for Pharo For The Enterprise, but that book is
actually pretty full. With other things like OSWindow and SDL coming
along, I wonder if there might be a new book called "Phoreign Pharo" to
accumulate solutions to access the world outside the Image.
cheers -ben