Import jmodelica error

14 posts / 0 new
Last post
adeas31
Offline
Joined: 2012-08-13
Import jmodelica error

Hi,
I just installed jmodelica1.8 on Windows7. I am getting the error on the python console,

import jmodelica
Traceback <most recent call last>:
File "<stdin>" line 1, in <module>
ImportError: No module named jmodelica
Adeel.

chria
Offline
Joined: 2009-07-29
Hi Adeel,   Since JModelica

Hi Adeel,
 
Since JModelica 1.7 we have split the JModelica Python package into three parts, pymodelica (containing the compiler), pyjmi (containing the optimization algorithms and DAE simulation framework) and pyfmi (all related to FMI). See the release notes from 1.7: http://www.jmodelica.org/api-docs/usersguide/1.7.0/ch13s01.html .
 
Best
/Christian

adeas31
Offline
Joined: 2012-08-13
Hi Christian, I don't

Hi Christian,
I don't understand what does it mean? I am new to JModelica. I am trying few examples from JModelicaUsersGuide-1.8.0.pdf and nothing seems to be working. For example I have tried "2.2. Simple FMU compilation example" and got this,
>>> from pymodelica import compile_fmu

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    from pymodelica import compile_fmu
ImportError: No module named pymodelica

Is there something wrong with my installation? I have also reinstalled JModelica once.
Adeel.

chria
Offline
Joined: 2009-07-29
Hi Adeel,   Are you using

Hi Adeel,
 
Are you using Windows or something else? If there was no error messages during the installation it should be ok.
 
Which shell/python console did you type does commands? Did you use either pylab or ipython from the JModelica.org shortcuts in the start menu? (or on Unix in install/bin/)
 
Best
/Christian

adeas31
Offline
Joined: 2012-08-13
Hi Christian, I am using

Hi Christian,
I am using Windows. IPython and pylab doesn't run. They just flash a screen and exit. I am trying the commands in python shell available from JModelica shortcuts in the start menu.
Adeel.

tove
Offline
Joined: 2009-04-08
Hi Adeel, If you edit, for

Hi Adeel,

If you edit, for example, the IPython.bat file in your JModelica.org 1.8 installation folder and add a "pause" at the end, you will be able to see the error message. That is:

 

@echo off
call C:\JModelica.org-1.8\setenv.bat
"C:\Python27\\python.exe" "C:\Python27\\scripts\ipython-script.py" %*
pause

And then try to start IPython from the start menu again. Could you please post the error here?

regards,
Tove

adeas31
Offline
Joined: 2012-08-13
c:\Python27\python.exe: can't

c:\Python27\python.exe: can't open file 'C:\Python27\scripts\ipython-script.py': [Errno 2] No such file or directory
Adeel.

armo
Offline
Joined: 2013-01-08
Ipython running exception

Hi Tove,
 
I have similar problem with the Ipython. The following error is appeared:
 
   "ImportError: No module names Extensions"
 
I checked the directory and there is no module with the name of Extension in non of the JModelica versions. Would you please help me to solve the problem. Because of it, I am using the python standard shell.
 
Best,
Arash
 
 

adeas31
Offline
Joined: 2012-08-13
I was missing some required

I was missing some required plugins. After installing them, things are working fine.
However, I want to know that once I import an FMU how can I save it to a file afterwards?
Adeel.

chria
Offline
Joined: 2009-07-29
I'm glad you got it

I'm glad you got it working!
 
I'm afraid it don't follow what you mean when you say that after you import your FMU you want to save it to file? When you import the FMU into JModelica it is from a file. Do you mean how you get the FMU after you have compiled a Modelica model? Please elaborate.
 
Best
/Christian

adeas31
Offline
Joined: 2012-08-13
I would like to see the

I would like to see the generated Modelica code. When i say,
myModel = FMUModel('myFMU.fmu')
Now, can i see the contents of myModel? OR can i save it to a file etc.
Adeel.

chria
Offline
Joined: 2009-07-29
There is no Modelica code.

There is no Modelica code. When a FMU is loaded using FMUModel the methods in the binary is connected according to the FMI specification and made available for simulation, manipulation etc, no Modelica code is generated.
 
Best
/Christian

adeas31
Offline
Joined: 2012-08-13
OK. Thanks for your

OK. Thanks for your help.
Adeel.

chria
Offline
Joined: 2009-07-29
No

No problem.
 
Best
/Christian

Login or register to post comments