-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python 3 support? #1
Comments
I just saw that OMEdit got rid of Corba recently - does that mean that Corba in OM is on its way out, or is this restricted to OMEdit? If the former that would probably help with a Python3 transition. |
The Python interface could indeed be changed to use dynamic loading as well. However, it is not as simple as for the C++ interface since that interface can access the macros used to start the garbage collector, create MetaModelica strings, and so on. For Python, all such interactions would probably need to be performed on a separate thread. Which means coding a Python C wrapper instead of CORBA... |
So, omniORB/omniORBpy 4.2.1 is now out, having full Python3 support (Python 3.2+/2.5+). :-) |
4.2.1: This release has the following known limitations: Only Python 2.x is supported. |
yeah, I saw this too, and I concluded that it was just an oversight (probably late-night release preparation ^^). |
Any news on Python3 support? Just starting to run into some other issues that it seems python3 might be able to solve but OMPython is holding me back from updating. |
not afaik, but OmniORB in fact seems to be py3-compatible, I see py3-related commit messages in the log. |
From the build for windows it seems Python3 really is supported: |
The most annoying thing I encounter with Python3 is that it clashes with Python2 installation. Seems to have to do with my |
I never had those problems on my Linux box, but I tended to install packages with pip - you only have to take care to use Nowadays, I'm using Anaconda for both Windows and Linux, and don't encounter many problems. |
You can also use |
I think at least for Windows the Python 3 issue is solved since omniorb > v4.2.0 supports Python 3. I have not tested this in practice. On Linux it is a different matter since the omniorb packages are currently out of date. |
So I did some tests and now found that OpenModelica is actually packaging OmniOrb (at least in the Windows installer). So if the OpenModelica team would be so kind to update the libraries in |
ZeroMQ is added as an alternative to omniORB in #23. However when I tried OMPython with Python 3.6 then I got errors from |
What errors? Omniorb being out of the way is a big step towards py3, i think, great work! |
|
I won't be at a PC to hunt this down for the next 2 weeks, but sounds like pyparsing is getting passed a number as integer, not converted to string, and chokes on that where there occurs a |
@adeas31 I tried the same steps as shown in your script snippet and OMC crashes, independent of Python version. |
I just tested the code snippet on a Ubuntu 16.04 64 bit installation with Python 3.5.2 and in my case it fails on:
https://gist.github.com/dietmarw/9a7128a06d4690992b214581a4dd0156 |
Same here. When runnign from IPython it just crashes, when running as a script from terminal, it also crashes, but it is possible to submit the core dump. |
Looks like also the Windows version has issues with this. |
Hmm that's weird. Can you send more information? |
The linux version is fixed in OpenModelica/OMCompiler#1686 |
It looks like that omc.exe is not added to the path during the windows installation. Hence it will only work if you are inside %OPENMODELICA%\bin. |
Looks like there are more parsing errors hidden. Using the simple example: package foo
model bar
parameter Real foo= 1;
Real bar;
equation
bar = 3*foo;
end bar;
end foo; I get the following error:
|
Does it work in other Python versions. e.g. in 2.7? |
No we need to set the environment for omc process. Should be fixed with #28 |
I have not tested it on Python 2 since that really is of no interest to me ;-) |
I've just ran an upgrade and also pyparsing 2.2.0 has the same issue. I guess it's not pyparsing but what is handed to it by |
I just ran Running |
#29 and #30 fixes the
|
I can confirm the simple example works on Windows with WinPython 2.7 and 3.4 @dietmarw For the fun of it, I ran the futurize script on OMPython, here is what it changed: |
It might be worth it to put all those things that are being tried out right now into a test suite so that it can easily be regression tested and also so that it's trivial to test different python versions and OSes. |
It now works for me on Windows and Linux, Python 2.7, Python 3.4 and Python 3.5!! |
Even though the simple example works, some things have to be checked, the following things are not available in Py3: |
Just a heads up that the windows nightly of OpenModelica does not yet contain the latest OMPython version. |
I just found another function that still relies on OmniORB although I run under Python 3: import OMPython
s = OMPython.OMCSession()
print(s.sendExpression("loadModel(Modelica)")) Gives:
|
@dietmarw that is in the Corba Session, so it is supposed to be there. |
OK but what would be the proper "porcelain" command that one uses independent of what communication method is used? |
Actually in order to not break existing scripts |
@dietmarw So you suggest to rename current OMCSession to OMCSessionCorba and introduce a new class OMCSession that points to OMCSessionCorba or OMCSessionZMQ, depending on what was found!? |
We can't rely on "what was found". On Windows platform omniORB binaries are always available since we ship them. I suggest we should use zeroMQ with OMCSession class, add a new class OMCSessionCorba and remove OMCSessionZMQ. We could also completely get rid of CORBA since we have ZeroMQ now. |
No we can't get rid of omniORB: we need to be able to launch old OMC versions using OMPython
Sent from BlueMail
…On 21 Jun 2017, 17:37, at 17:37, Adeel Asghar ***@***.***> wrote:
We can't rely on "what was found". On Windows platform omniORB binaries
are always available since we ship them.
I suggest we should use zeroMQ with OMCSession class, add a new class
OMCSessionCorba and remove OMCSessionZMQ.
We could also completely get rid of CORBA since we have ZeroMQ now.
--
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#1 (comment)
|
The Windows installer for OpenModelica v1.13.0-dev-43-g6554061 (64-bit) still includes an old version of omniORB which is NOT Py3 compatible. Could you please package the latest omniORB version with the OpenModelica installer for Windows? |
The whole idea of adding ZeroMQ is to avoid updating omniORB. |
@bilderbuchi I believe we can close this issue now? |
Yes, you can close it, and then whoever finds a problem should open a new issue. |
Agreed, thank you everyone for the great work! 👏 |
It seems OmniORB is the holdup keeping Python support to version 2. As I was digging around, I found that apparently the dev version/upcoming version offer Python 3 support, judging from some commit messages since 07/2014 and even some parts of the current version support Py3, so I thought I'd leave that here.
The text was updated successfully, but these errors were encountered: