Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Enhanced OMPython Features

Enhanced OMPython Features

Hi all,

I've recently installed Anaconda2-4.3.0.1-Windows-x86_64 and OpenModelica1.11.0-64bit.
I've tried to follow the example from https://openmodelica.org/doc/OpenModeli … ython.html but I get this error running in python

>>>mod=ModelicaSystem("mypath/BouncingBall.mo","BouncingBall")

2017-02-27 17:12:56,349 - OMCSession - INFO - OMC Server is up and running at file:///c:\users\1474933\appdata\local\temp\openmodelica.objid.ce932d05a8c84a48b17a7b6ce3e79922
Expected end of text (at char 177), (line:3, col:57)

...and when I try

>>> mod=ModelicaSystem("C:/OpenModelica1.11.0-64bit/share/doc/omc/testmodels/dcmotor.mo","dcmotor")

2017-02-27 17:16:09,661 - OMCSession - INFO - OMC Server is up and running at file:///c:\users\1474933\appdata\local\temp\openmodelica.objid.45f14d6372e04a34ae650425d8dd3924
[C:/OpenModelica1.11.0-64bit/share/doc/omc/testmodels/dcmotor.mo:2:3-2:66:writable] Error: Class Modelica.Electrical.Analog.Basic.Resistor not found in scope dcmotor.
Error: Error occurred while flattening model dcmotor

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Anaconda2\lib\site-packages\ompython-2.0.7-py2.7.egg\OMPython\__init__.py", line 545, in __init__
    self.__loadingModel(self.fileName, self.modelName, self.lmodel)
  File "C:\Anaconda2\lib\site-packages\ompython-2.0.7-py2.7.egg\OMPython\__init__.py", line 588, in __loadingModel
    self.tree = ET.parse(self.xmlFile)
  File "C:\Anaconda2\lib\xml\etree\ElementTree.py", line 1182, in parse
    tree.parse(source, parser)
  File "C:\Anaconda2\lib\xml\etree\ElementTree.py", line 647, in parse
    source = open(source, "rb")
IOError: [Errno 22] invalid mode ('rb') or filename: ''

The least one seems a version conflict with the anaconda package distribution. Any idea? Should I downgrade anaconda? What downgrade version to use?

There are 0 guests and 0 other users also viewing this topic