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
  • Index
  • » Users
  • » leo7
  • » Profile

Posts

Posts

Dec-22-14 10:01:59
AttributeError: 'module' object has not attribute 'run'

# Anyway - the first example working for OMPython  version 2.0
#---------------------
from OMPython import OMCSession
OMPython = OMCSession()
OMPython.execute('getVersion()')

print OMPython.execute("loadModel(Modelica)")
print OMPython.execute  ("loadFile(\"C:/OpenModelica1.9.1/share/doc/omc/testmodels/BouncingBall.mo\")")
result = OMPython.execute("simulate(BouncingBall)")
print OMPython.execute("plot(h)")

print '\n' ,'result = ', '\n', result,'\n' ,'\n'

Dec-22-14 09:31:13
AttributeError: 'module' object has not attribute 'run'

Hmmm there are more things changed as for instance the get


from OMPython import OMCSession
OMPython = OMCSession()
OMPython.execute('getVersion()')

OMPython.execute("loadModel(Modelica)")
OMPython.execute("loadFile(\"C:/OpenModelica1.9.1/testmodels/BouncingBall.mo\")")
result = OMPython.execute("simulate(BouncingBall)")
OMPython.execute("plot(h)")

print '\n' ,'result = ', '\n', result,'\n' ,'\n'

print  OMPython.get(result, 'SET2.Elements.Line3.Properties.Values')

--> Error


Is there any help examples for version 2?

Thanks,
Leo


Dec-22-14 07:54:54
AttributeError: 'module' object has not attribute 'run'

Hi sjoelund.se,

That is good to know...

I googled on this error but could not find this info..
(Maybe something to be updated in manuals etc. - for now from now on your answer post will pop up if people google this)

Thanks !,
Leo

Dec-22-14 00:41:17
AttributeError: 'module' object has not attribute 'run'

Hello everybody..

I am using Python trying to get connected to OpenModelica
I have the exact same error: "OMPython.run()  AttributeError: 'module' object has no attribute 'run"

My 'program':

import OMPython
OMPython.run()

installed OMPython using:
1- setup.py from the Open Modelica 1.9.1 dir
2- pip install OMPython
same results

Help is very welcome !

  • Index
  • » Users
  • » leo7
  • » Profile
You are here: