Getting started

2 posts / 0 new
Last post
Gary
Offline
Joined: 2011-01-18
Getting started

Hi
My computer is windowsxp, and I intalled jdk-6u24-windows-i586.exe, python-2.6.msi,python-2.6.msi and
JModelica.org-1.4.exe, I use JModelica.org UsersGuide-1.4.0
Check my installation like this:
>>> from jmodelica import check_packages
C:\Python26\lib\site-packages\jpype\_pykeywords.py:18: DeprecationWarning: the s
ets module is deprecated
import sets
>>> check_packages()

Performing JModelica package check
==================================

Platform...................... win32

Python version:............... 2.6

JModelica version:............ 1.4

Dependencies:

Package Version
------- -------
numpy......................... 1.3.0 Ok

scipy......................... 0.7.1 Ok

matplotlib.................... 0.99.1 Ok

jpype......................... -- Ok

lxml.......................... 2.2.2 Ok

nose.......................... 0.11.1 Ok

assimulo...................... -- Ok

pyreadline.................... 1.5 Ok

Check my installation like this:
>>> from jmodelica import check_packages
C:\Python26\lib\site-packages\jpype\_pykeywords.py:18: DeprecationWarning: the s
ets module is deprecated
import sets
>>> check_packages()

Performing JModelica package check
==================================

Platform...................... win32

Python version:............... 2.6

JModelica version:............ 1.4

Dependencies:

Package Version
------- -------
numpy......................... 1.3.0 Ok

scipy......................... 0.7.1 Ok

matplotlib.................... 0.99.1 Ok

jpype......................... -- Ok

lxml.......................... 2.2.2 Ok

nose.......................... 0.11.1 Ok

assimulo...................... -- Ok

pyreadline.................... 1.5 Ok

but when I(a postgraduate student in China) learn the JModelica.org step by step acording to the UsersGuide-1.4.0, simpling compilation
example:

>>> from jmodelica.jmi import compile_jmu
JVM started.
>>> model_name = 'myPackage.myModel'
>>> mo_file = 'myPackage.mo'
>>> compile_jmu(model_name, mo_file)
Traceback (most recent call last):
File "", line 1, in
File "C:\JModelica.org-1.4\Python\jmodelica\jmi.py", line 5997, in compile_jmu

comp.compile_model(class_name, file_name, target=target)
File "C:\JModelica.org-1.4\Python\jmodelica\compiler.py", line 453, in compile
_model
self._handle_exception(ex)
File "C:\JModelica.org-1.4\Python\jmodelica\compiler.py", line 736, in _handle
_exception
'\n Stacktrace: '+ex.stacktrace().encode('utf-8'))
IOError: Message: myPackage.mo (The system could not find the specified file
?
Stacktrace: java.io.FileNotFoundException: myPackage.mo (The system could not find the specified file
?
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(Unknown Source)
at java.io.FileInputStream.(Unknown Source)
at java.io.FileReader.(Unknown Source)
at org.jmodelica.modelica.compiler.ParserHandler.parseModelicaFile(Parse
rHandler.java:81)
at org.jmodelica.modelica.compiler.ParserHandler.parseFile(ParserHandler
.java:56)
at org.jmodelica.modelica.compiler.ModelicaCompiler.parseModel(ModelicaC
ompiler.java:539)
at org.jmodelica.modelica.compiler.ModelicaCompiler.parseModel(ModelicaC
ompiler.java:582)
at org.jmodelica.modelica.compiler.ModelicaCompiler.compileModel(Modelic
aCompiler.java:471)

I don`t know how to solve the problem.
MY msn is garry.198500@hotmail.com, I need help sincerely from everyone.
Best wish!
Gary

jmattsson
Offline
Joined: 2009-10-18
File not found

Hi Gary

Note the error message at the top of the stacktrace: "myPackage.mo (The system could not find the specified file". It is likely that your current working directory isn't the one containing the file "myPackage.mo". You can try using an absolute path, or changing the current working directory.

You can manipulate your current working diretory using the commands:

import os
os.getcwd()
os.chdir('<new working directory>')

 

Login or register to post comments