Opened 6 years ago

Closed 6 years ago

#5271 closed defect (worksforme)

Cannot import to Python

Reported by: asnaumoff@… Owned by: Alachew Mengist
Priority: high Milestone:
Component: OMPython Version:
Keywords: Cc:

Description

Hi!

I use Mac OS Mojave and python 3.6.8.

Cannot create OMCSessionZMQ. I installed OM 1.13 and ompython via

python -m pip install -U https://github.com/OpenModelica/OMPython/archive/master.zip

I get the following error:

from OMPython import OMCSessionZMQ
omc = OMCSessionZMQ()
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-1-f44c8e4c7a10> in <module>
      1 from OMPython import OMCSessionZMQ
----> 2 omc = OMCSessionZMQ()

~/tensorflow/lib/python3.6/site-packages/OMPython/__init__.py in __init__(self, readonly, timeout)
    531 
    532     def __init__(self, readonly=False, timeout = 0.25):
--> 533         OMCSessionHelper.__init__(self)
    534         OMCSessionBase.__init__(self, readonly)
    535         self._create_omc_log_file("port")

~/tensorflow/lib/python3.6/site-packages/OMPython/__init__.py in __init__(self)
    115       path_to_omc = spawn.find_executable("omc")
    116       if path_to_omc is None:
--> 117         raise ValueError("Cannot find OpenModelica executable, please install from openmodelica.org")
    118       self.omhome = os.path.split(os.path.split(os.path.realpath(path_to_omc))[0])[0]
    119   def _get_omc_path(self):

ValueError: Cannot find OpenModelica executable, please install from openmodelica.org
os.environ.get('OPENMODELICAHOME')
}}} says nothing :(

Change History (3)

comment:1 by asnaumoff@…, 6 years ago

Component: *unknown*OMPython
Owner: changed from somebody to Alachew Mengist

comment:2 by Martin Sjölund, 6 years ago

You need to set the PATH environment variable or OPENMODELICAHOME to point to the installation.

comment:3 by Martin Sjölund, 6 years ago

Milestone: Future
Resolution: worksforme
Status: newclosed
Note: See TracTickets for help on using tickets.