I would use only the Python bridge but not the Blender features (Cube,
etc). Will be the Python bridge and parser contained in its own package?

I have started from MinGW and evaluated

Ephestos sendMessage: 'print("hello world")'.
Ephestos sendMessage: 'x = 3'.
Ephestos getValue: 'x'.

$ python pyAtlas.py
creating thread
calling create_socket_connection
hello world
('pherror : ', ['', 'no error\n'])
I have sent err : --->no error
 <---- and removed it from the list of errors
('pherror : ', ['', 'no error\n'])
I have sent err : --->no error
 <---- and removed it from the list of errors
('eval with pherror: ', ['', 'RetValue:3'])
('pherror : ', ['', 'RetValue:3'])
I have sent err : --->RetValue:3 <---- and removed it from the list of
errors

Is this expected?

I don't know if there are other reasons but you could download the raw .py
file from https://raw.githubusercontent.com/kilon/pyAtlas/master/pyatlas.py
using Metacello Configuration and start the script using OSProcess or
ProcessWrapper. This is how I do it for BioSmalltalk:

>>...
    spec for: #'common' do: [
        spec blessing: #'baseline'.
        spec preLoadDoIt: #preLoad.

>>preLoad
    | urlIndex |
    urlIndex := 1.
    [ self downloadFiles: urlIndex ]
    on: ZdcPluginMissing
    do: [ : ex |
        urlIndex := urlIndex + 1.
        ex retry ].

>>downloadFiles: urlIndex
    | url response |
    url := (self platformFilesUrl at: urlIndex) asZnUrl.
    fileRef := FileSystem disk workingDirectory / url pathSegments last.
    (response := ZnEasy get: url) isSuccess
        ifTrue: [ fileRef writeStreamDo: [ : stream | stream nextPutAll:
response contents ] ]
        ifFalse: [ self error: 'Cannot download files' ]

>>platformFilesUrl
    " Answer a <Collection> of download URLs for the current platform "

    ^ Smalltalk os isWin32
        ifTrue: [ #('http://...zip'
            'http://...zip') ]
        ifFalse: [ #('http://....tar.gz'
            'http://....tar.gz') ].

Cheers,

Hernán



2014-09-25 14:11 GMT-03:00 kilon alios <kilon.al...@gmail.com>:

> 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