Its far from excellent. Its not as tested as I want it to be, and the code
could be much better but it works and makes interfacing with python code
very easy.

Its also an ongoing project that I will keep adding feature to , for
example I would like to extend pharo syntax to more complex stuff than
calling python methods like defining python classes etc so you wont have to
use sendMessage and getValue at all and not have to write a line of python
code. In short do all your python coding using 100% pharo syntax. But that
will take a lot of time to do because it will require a fully python syntax
parser.

I have updated the code to resolve the error when issuing a command to
close the bridge with

Ephestos sendMessage:'exit'.

This command basically terminate pyAtlas and closes it server socket.

I dont know if its Pharo or Python or Macos but it looks like it takes time
to free up the socket address so you will need 20 seconds to restart
pyAtlas again. I tried to set the timeout of the socket to 1 second but it
looks to me it still uses the default 20 seconds timeout. I guess 20 sec is
not that bad for a pre alpha software :D

But anyway that should not be a problem since you will have to rerun
pyatlas every 20 sec , which is something you would not want to do .

I was actually planning to test Ephestos with pyQT and pyCuda and make a
youtube video about it but have not found the time yet. Probably in the
weekend.

On Thu, Sep 25, 2014 at 9:23 PM, Pablo R. Digonzelli <pdigonze...@gmail.com>
wrote:

> 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:
>>
>>>  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
>>> pdigonze...@gmail.com
>>> Cel: 5493815982714
>>>
>>>
>>> Search the [pharo-dev] list for Ephestos by kilon.
>>> cheers -ben
>>>
>>
>>
>

Reply via email to