OMPython icon indicating copy to clipboard operation
OMPython copied to clipboard

OMPython breaks with Python 3.12

Open JaxRaffnix opened this issue 2 years ago • 1 comments

Description

OMPython is not compatible with python 3.12 because distutils is deprecated. See 1 for details.

OMPython imports spawn from distutils and uses the find_executable() function for the class OMCSessionHelper.

Steps to reproduce

Install OpenModelica and Python 3.12. Install OMPython with this guide 2. Execute a test script:

from OMPython import OMCSessionZMQ
omc = OMCSessionZMQ()`

Expected behavior

Change the function find_executable() with the recommended subprocess.run().

Version and OS

  • Python Version
>>> import sys
>>> sys.version
'3.12.0 (tags/v3.12.0:0fb18b0, Oct  2 2023, 13:03:39) [MSC v.1935 64 bit (AMD64)]'
  • OMPython Version
>>> pip show OMPython
Name: OMPython
Version: 3.4.0
  • OpenModelica Version
OpenModelica1.23.0-dev-64bit

OS:

>>> cmd /c ver
Microsoft Windows [Version 10.0.19045.3448]

JaxRaffnix avatar Oct 13 '23 09:10 JaxRaffnix

@JaxRaffnix I suggest you to manually setup the install after downloading the OMPython repo and do

>>> python setup.py install

arun3688 avatar Oct 13 '23 11:10 arun3688

It's not good when OMPython isn't running out of the box on Python 3.12 and newer. I encountered this in some CI I'm creating. setup.py isn't easily available when installing OMPython via pip.

@arun3688 we should move towards setuptools.

AnHeuermann avatar Jul 08 '24 11:07 AnHeuermann