← Back to team overview

yade-users team mailing list archive

[Question #234513]: import an external library

 

New question #234513 on Yade:
https://answers.launchpad.net/yade/+question/234513

Hi all, 

I am trying to import an external library nsmp1d_yade.so in my script (see below) and I don't succeed to do it. 
When I am using my script with python, doing :
python Simple.py
everything is working and the script is using the content of the library. 
However, when I am running the same script with yade :
yade-daily Simple.py

I get an error : 
Welcome to Yade 3+3698+47~precise1
TCP python prompt on localhost:9000, auth cookie `ucdsea'
XMLRPC info provider on http://localhost:21000
Running script Simple.py
Traceback (most recent call last):
  File "/usr/bin/yade-daily", line 168, in runScript
    execfile(script,globals())
  File "Simple.py", line 2, in <module>
    from nsmp1d_yade import *
ImportError: No module named nsmp1d_yade


I don't understand why it is working with python and not with Yade.
Do you have any idea of how I can solve this problem? 

Thank you 

Raphael



Here is my script Simple.py : 

from nsmp1d_yade import *

from pylab import *
from matplotlib import pyplot
import matplotlib.gridspec as gridspec
import numpy as np

## Define the situation
rho_f = 1000
rho_s = 2500
slope = 1e-4
visco_f = 1e-3
dp=6e-3
ndimz=301
h=1.
dsig=np.zeros(ndimz)
dsig[0:ndimz-1]=h/(double(ndimz-1))
sig=linspace(0e0,1e0,ndimz)

ufnp   = np.zeros(ndimz)
ufn    = np.zeros(ndimz)
alphaf = np.zeros(ndimz)
us     = np.zeros(ndimz)
alphas = np.zeros(ndimz)
alphaf=1e0-alphas
tfin=2000.
dt=1e-1

ufnp=nsmp1d_yade(h,sig,dsig,dp,ufn,alphaf,us,alphas,tfin,dt)

##
## plots
##

zmin=0
zmax=h

umin=min(ufnp)
umax=max(ufnp)

figure(1)

plot(ufnp,sig*h,'ob',label='u_f')
title('U_f')
#axis([1200, 1900, zmin, zmax])
xlabel('U_f (m/s)')
ylabel('z (m)')
axis([umin, umax, zmin, zmax])

show()

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.