How to get YadeVerion and executable file to create Wrapper .py

Asked by Surej Kumar

Hello,

I need to generate a .py file linked to the executable file by “ln yade-versionNo yadeimport.py" Can anyone help how to do this

Any sample .py file will be great so that I just change it.

From YADE Document " After installation and we get the executable file: yade-versionNo. We then generate a .py file linked to the executable file by “ln yade-versionNo yadeimport.py”. This .py file will serve as a wrapped library of YADE. Later on, we will import all YADE functions into the python script through “from yadeimport import *"

I am using Ubuntu 18.04 and installed directly from Ubuntu. Where normally the installation files location.

Thanks and best reagrds

Surej.

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Surej Kumar
Solved:
Last query:
Last reply:
Revision history for this message
Jan Stránský (honzik) said :
#1

Hello Surej,

1)
with prepackaed version, you can use (this works on 16.04, let us know how it works on 18.04)

sudo apt-get install python-yade

and in python script use

from yade import *

2)
if you want to use ln, you can try
ln -s /usr/bin/yade yadeimport.py

cheers
Jan

Revision history for this message
Jan Stránský (honzik) said :
#2

Hello Surej,

1)
with prepackaed version, you can use (this works on 16.04, let us know how it works on 18.04)

sudo apt-get install python-yade

and in python script use

from yade import *

2)
if you want to use ln, you can try
ln -s /usr/bin/yade yadeimport.py

cheers
Jan

Revision history for this message
Surej Kumar (surej) said :
#3

Thanks Jan

I downgraded to Ubuntu 16t.04 to be on safe side. I manage to get what I
need but I could not run the last step to reproduce FEMxDEM workflow.

*import sys // ok no error
sys.path.append('/home/s/Desktop/myYADE/Build') // ok no error
from yadeimport import * // ok no error Then I run : yade
prepareRVE.py // no problem as I create 0.yade.gz
fileOmega().load('/home/s/Desktop/myYADE/Build/0.yade.gz') //ok no
error
*

The user manuals says : If you are successful, you should also be able to
run

When i try to run the below I am getting error

*from simDEM import **

Error message is :

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named simDEM

Can you please help.

Thanks and best regards

surej.

On Thu, Jun 28, 2018 at 6:09 PM, Jan Stránský <
<email address hidden>> wrote:

> Your question #670527 on Yade changed:
> https://answers.launchpad.net/yade/+question/670527
>
> Jan Stránský proposed the following answer:
> Hello Surej,
>
> 1)
> with prepackaed version, you can use (this works on 16.04, let us know how
> it works on 18.04)
>
> sudo apt-get install python-yade
>
> and in python script use
>
> from yade import *
>
> 2)
> if you want to use ln, you can try
> ln -s /usr/bin/yade yadeimport.py
>
> cheers
> Jan
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
> https://answers.launchpad.net/yade/+question/670527/+confirm?answer_id=1
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/yade/+question/670527
>
> You received this question notification because you asked the question.
>

Revision history for this message
Jan Stránský (honzik) said :
#4

As the error says, python does not know about simDEM module..

the documentation says, that it is part of Yade source code, in my case it located at
/usr/lib/x86_64-linux-gnu/yade/py/yade/FEMxDEM/simDEM.py
so to be able to import it, you have to tell python where it is. What I have tried:

in shell:
mkdir /tmp/test
cd /tmp/test
ln -s /usr/bin/yade yadeimport.py
cp /usr/lib/x86_64-linux-gnu/yade/py/yade/FEMxDEM/simDEM.py .
# create test.py, see below
python test.py

content of test.py:
###
from simDEM import *
print avgRotation3D
###

cheers
Jan

Revision history for this message
Surej Kumar (surej) said :
#5

Thanks Jan

It work now.