Yes , I was aware of the excellent work of kilon. 
I was hoping that this be the way to solve my issue. 

Thanks kilon, I will follow your instructions and comment the results into the 
list. 



Ing. Pablo Digonzelli 
Software Solutions 
IP-Solutiones SRL 
Metrotec SRL 
25 de Mayo 521 
Email: pdigonze...@softsargentina.com 
pdigonze...@gmail.com 
Cel: 5493815982714 


De: "kilon alios" <kilon.al...@gmail.com> 
Para: "Any question about pharo is welcome" <pharo-users@lists.pharo.org> 
Enviados: Jueves, 25 de Septiembre 2014 14:13:34 
Asunto: Re: [Pharo-users] invoking python from pharo 

a minor correction to the previous email its 
python3 pyatlas.py and not python3 pyAtlas.py 

also I forgot to make clear that it works for pyhton 2.7 and python 3. 

On Thu, Sep 25, 2014 at 8:11 PM, kilon alios < kilon.al...@gmail.com > 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 > wrote: 

BQ_BEGIN

Pablo R. Digonzelli wrote: 
BQ_BEGIN

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 
pdigonze...@gmail.com 
Cel: 5493815982714 



Search the [pharo-dev] list for Ephestos by kilon. 
cheers -ben 

BQ_END



BQ_END


Reply via email to