Integrating Python, was Re: The New Product

Nick Renders omnis1 at arcict.com
Tue Sep 13 09:23:49 UTC 2022


Hi Stefan,

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:

	print("Hello World")

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?


Thanks,

Nick Renders


On 29 May 2022, at 17:15, Stefan Csomor wrote:

> Hi
>
>>   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$
>
> Best,
>
>
> Stefan
>
> _____________________________________________________________
> 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 mailing list