Calling Python from Pharo

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Calling Python from Pharo

Alberto Bacchelli
Hi,

  Is there any way to make Pharo and Python communicate?

Thanks,
  Alberto

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Calling Python from Pharo

Michael Roberts-2
Depends what level....
At a high level you could use OSProcess to invoke the correct Python
command line and do it in a different process. Or you could use some
socket protocol if you have a python interpreter already running
waiting for commands. or a mixture of the two...

At a lower level you could look to link Python as a C library.

cheers,
Mike

On Tue, Sep 28, 2010 at 10:56 PM, Alberto Bacchelli
<[hidden email]> wrote:

> Hi,
>
>  Is there any way to make Pharo and Python communicate?
>
> Thanks,
>  Alberto
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Calling Python from Pharo

Igor Stasenko
There is a Python bridge plugin. But its not open source.

On 29 September 2010 01:30, Michael Roberts <[hidden email]> wrote:

> Depends what level....
> At a high level you could use OSProcess to invoke the correct Python
> command line and do it in a different process. Or you could use some
> socket protocol if you have a python interpreter already running
> waiting for commands. or a mixture of the two...
>
> At a lower level you could look to link Python as a C library.
>
> cheers,
> Mike
>
> On Tue, Sep 28, 2010 at 10:56 PM, Alberto Bacchelli
> <[hidden email]> wrote:
>> Hi,
>>
>>  Is there any way to make Pharo and Python communicate?
>>
>> Thanks,
>>  Alberto
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



--
Best regards,
Igor Stasenko AKA sig.

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Calling Python from Pharo

Adrian Lienhard
Or use HTTP (a RESTful webservice with JSON is straightforward to implement on both sides).

Adrian


On Sep 29, 2010, at 00:43 , Igor Stasenko wrote:

> There is a Python bridge plugin. But its not open source.
>
> On 29 September 2010 01:30, Michael Roberts <[hidden email]> wrote:
>> Depends what level....
>> At a high level you could use OSProcess to invoke the correct Python
>> command line and do it in a different process. Or you could use some
>> socket protocol if you have a python interpreter already running
>> waiting for commands. or a mixture of the two...
>>
>> At a lower level you could look to link Python as a C library.
>>
>> cheers,
>> Mike
>>
>> On Tue, Sep 28, 2010 at 10:56 PM, Alberto Bacchelli
>> <[hidden email]> wrote:
>>> Hi,
>>>
>>>  Is there any way to make Pharo and Python communicate?
>>>
>>> Thanks,
>>>  Alberto
>>>
>>> _______________________________________________
>>> Pharo-project mailing list
>>> [hidden email]
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>
>
>
> --
> Best regards,
> Igor Stasenko AKA sig.
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Calling Python from Pharo

Jimmie Houchin-5
In reply to this post by Alberto Bacchelli
On 9/28/2010 4:56 PM, Alberto Bacchelli wrote:
Hi,

 Is there any way to make Pharo and Python communicate?

Thanks,
 Alberto
On 28 September 2010 20:10, Alexandre Bergel [hidden email] wrote:
> Hi!
>
> Is there a statistic library in Pharo?
> Computing the correlation, linear regression, ...
>
> Cheers,
Hi Alexandre,

 My question about a connection between Pharo and Python [1] is
related to the issue you are reporting.
In Python, they have numpy [2], which offers almost anything one would
need for statistics, algebra, ...
Instead of re-implementing everything in Pharo (aka re-inventing the wheel),
imho, it would be much better to be able to exploit the good work
already done by these smart people.

My interest to Alien FFI is also related: Instead of using numpy, one
could use the external interface offered by MATLAB [3] (in the form of
C APIs) to let it do the number crunching. Even though the MATLAB
external interface is very simple and clean, I have not being able to
use it from Pharo, yet, because I cannot make Alien work under Linux
(where my MATLAB resides). I have also tried nativeboost, but I am
still not able to create the VM with the necessary plugin to make it
work.
It is very frustrating: Even if I am working with Fernando (who knows
Alien very good), in three days we have not reach any target.

It would be awesome if someone else wanted to give me a hand with this task:
I believe It would be of interest for many of us.

Cheers,
 Alberto

Hello Alberto,

I have been much in the same situation. I am developing a financial technical analysis application in Pharo. Part of my requirements are the use of a Windows COM dll. I do not have the ability to use that dll from within Pharo. (My skills are too limited)  I have written the front end/back end of my application in Python interfacing the dll and the financial server. I am writing the middle part of the application in Pharo using Seaside. My Python app will call my Seaside app with the necessary data and my Seaside app will provide the Python app the necessary actions. This also enables me to provide a web interface to my application.

Numpy is an attractive option. I have been a long time Squeak (and now Pharo) user. I much prefer Pharo to Python. With my learning about the Matrix class I wasn't as dependent on Numpy. I switched to Pharo. Presently I am providing my own calculations and formulas and wasn't dependent on the statistics in Numpy.

I would love to drop the Python dependency completely. Hopefully in time that will come.

Any way, that is how I am using Python and Pharo.

Jimmie

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project