Jump to content

Recommended Posts

Hi all,

 

I want to use msolve api in Pyhton. But, I didn't define msolve library correctly.
At first, When I tried use msolve library, I got the following error message.

 

image.png.78c854f7b5a3e161ed7ed4589bad9e84.png

I found the msolve library on this file path 'C:\Program Files\Altair\2020\hwsolvers\motionsolve\msolve' and copy to this path 'C:\Program Files\Anaconda3\Lib'. I solved this problem, but I got the new error message. You can see below.

 

image.png.cb82dc7f322a270a1adf714a7356b7f7.png

 

How can I define ms_modelapi35 and run correctly msolve api ?

 

Thanks for the replies.

 

Share this post


Link to post
Share on other sites
Did you try?

C:\Users\rajivr\Desktop\lugre> python 
Python 2.7 (r27:82500, Apr 5 2012, 14:38:31) [MSC v.1600 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from msolve import *
>>> import math
>>>

 

If this doesn't work as expected, you may need to set your environment variables.

 

 

Python uses PYTHONPATH environment variable to modules for importing. If the interpreter raises a ModuleNotFound traceback upon the command ‘from msolve import *’ then it means that the msolve module was not found. In order to ensure that ‘msolve’ is found, what you can do is to define PYTHONPATH to point to the location on your filesystem where the msolve folder (and its __init__.py) are located.

For example on my system, msolve is located in:

D:\p4\mbd\qa\python\msolve

 

In order to be able to invoke ‘from msolve import *’ or ‘import msolve’ from anywhere the interpreter is invoked, I set the PYTHONPATH environment variable to point to that location:

 

set PYTHONPATH= D:\p4\mbd\qa\python\msolve\python

 

If you have multiple folders containing modules that you want to import, you can set PYTHONPATH to multiple values separated by semicolons, e.g.:

 

set PYTHONPATH= D:\p4\mbd\qa\python\msolve\python;%NUSOL_DLL_DIR%

 

Share this post


Link to post
Share on other sites

Hi Chris,

 

Sorry for late reply. I tried define msolve folder but I didn't solve my problem.

 

904975202_2020-07-0608_40_01-Window.png.4c31671c906c0c43be17a310ace0ae2d.png

 

I defined this folder path in PYTHONPATH environment variable. But again, I faced the error message ms_modelapi35.

I found that the file '__Init__' has the extension '.pyc'. You can see above. Am I using the correct library to define the msolve library? Do I need to install another library?

Share this post


Link to post
Share on other sites

Have you tried the initial tutorials for using the motionsolve Python API we have in our installation?  If those do not work, I would suggest contacting Altair support.  This could be related to your installation, and might be difficult to troubleshoot here.

Share this post


Link to post
Share on other sites

By the way, Chris.

 

 

Who is this Jenkins guy mentioned in the bad words coming from MSolve?

 

Is that a dir. on de development server of MSolve? 

Is that Py code frozen in the Pyc files?

 

Interesting traces, if you ask me.

 

Just a stupid remark/question..

 

 

Kind regards,

 

Chris

 

 

 

Share this post


Link to post
Share on other sites

Hi Chris-

I believe "Jenkins" is just the name of one of the development servers.  I'm more focused on the application side, rather than software development.  The code I posted previously was from an internal email from one of our developers when someone internally was having a similar issue.  I'm not a regular user of the .py methods in motionsolve (yet!!).  Always learning!

 

 

Share this post


Link to post
Share on other sites

Chris,

 

I guessed that indeed.  Just looks like such a funny glitch to me.

 

Digging in the Py stuff around MV has become my daily activity since we (Altair + CM-Labs + Sayfield) have

made a model export from MV to Vortex.

This allows MV users you to perform a Real-Time simulation of an MV model in less than an hour. :):)

 

Keep posted for more news on this side. 

 

I also hope to expect some more news on the Python side of MV in the near future.

 

Kind regards,

 

Chris

 

Share this post


Link to post
Share on other sites

×
×
  • Create New...