Integrating Python, was Re: The New Product
csomor at advancedconcepts.ch
Tue Sep 13 12:56:39 UTC 2022
The sample does work with your installation ?
You cannot return a value from a file executed in python, only from methods. Your sample in my setup results in a "Hello World" in the Trace log though, so it is running ... I haven't added passing arguments into $runfile either. You should communicate through the omnis module using python calls as in the sample.
Am 13.09.22, 11:24 schrieb "omnisdev-en im Auftrag von Nick Renders" <omnisdev-en-bounces at lists.omnis-dev.com im Auftrag von omnis1 at arcict.com>:
Thank you very much for sharing your oPython external.
As a Python newbie, I am having a bit of a problem getting it to run, though.
I am trying to run a simple test.py file with the following contents:
and the following Omnis code:
Do oPy3Lib.$runfile("/Volumes/Free/test.py","__main__") Returns #S1
but #S1 remains empty.
I am probably making some rookie mistake.
Is this how the $runfile function is supposed to work?
Does it return anything that is printed?
And on a related note, is it possible to specify arguments (sys.argv value) with the $runfile function?
On 29 May 2022, at 17:15, Stefan Csomor wrote:
>> But a good python integration literally opens up the whole of the python
>> extensions world to be available inside Omnis.
> I've done a presentation of Python integration into Omnis in 2008, I've also pushed the code to github, updated for Python 3, https://github.com/advancedconcepts/opython but this was rather for integrating Python into the main / GUI thread.
> The problem with background language workers using python is that CPython itself is not very well suited to profit from multiple cores when multithreading - there still is a global object GIL (Global Interpreter Lock) that each thread has to acquire when active, so in order to really profit from multi-core / multi-processor machines you'd have to use a multi-process solution, which is a little bit more complex. (When your python multi-threaded code is primarily IO bound or effectively wrapping a c-library that itself is benefitting from multiple cores then things are different of course).
> Just my 0.02$
> Manage your list subscriptions at https://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
Manage your list subscriptions at https://lists.omnis-dev.com
Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
More information about the omnisdev-en