how to run examples from a terminal

Asked by Jack Wang on 2011-10-18

Hi,
I am a green hand in Yade. I am using Ubuntu2.6.32-34.I have installed yade-0.60.3 and Python2.6.5 successfully. But when I run the examples,some problems occur.

kinn@kinn-desktop:~$ cd /home/kinn/YADE/bin
kinn@kinn-desktop:~/YADE/bin$ python yade-0.60.3 mill.py
Welcome to Yade 0.60.3
TCP python prompt on localhost:9000, auth cookie `uscaks'
XMLRPC info provider on http://localhost:21000
Running script mill.py
Traceback (most recent call last):
  File "yade-0.60.3", line 152, in runScript
    execfile(script,globals())
IOError: [Errno 2] No such file or directory: 'mill.py'
[[ ^L clears screen, ^U kills line. F8 plot. ]]
Yade [1]:

Please help me
Thanks

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Bruno Chareyre
Solved:
2011-10-19
Last query:
2011-10-19
Last reply:
2011-10-18
Christian Jakob (jakob-ifgt) said : #1

1.) you do not have start python before executing yade, so

yade-0.60.3 mill.py

will be enough.

2.) if you are in the folder /home/kinn/YADE/bin and you want to run mill.py, there are two ways:

- copy mill.py to /home/kinn/YADE/bin and use the command above
- OR cd to the folder, where mill.py is and use following command:

/home/kinn/YADE/bin/yade-0.60.3 mill.py

Regards,

Christian

Jérôme Duriez (jduriez) said : #2

Hello,

If you still face problems, it could be useful you give a look at previous question https://answers.launchpad.net/yade/+question/152906

Jack Wang (songjiepy) said : #3

Thank you, Christian. But I find it still can't run regularly.

I copy mill.py to /home/kinn/YADE/bin and use the command you said.

kinn@kinn-desktop:~$ cd /home/kinn/YADE/bin
kinn@kinn-desktop:~/YADE/bin$ python mill.py
Traceback (most recent call last):
  File "mill.py", line 11, in <module>
    from yade import pack
ImportError: No module named yade

Christian Jakob (jakob-ifgt) said : #4

No, I said:

yade-0.60.3 mill.py

NOT

python mill.py

In general the structure of terminal commands is:

/PATH/TO/EXECUTABLE/executable /PATH/TO/SCRIPT/script.py

Good luck.

Jack Wang (songjiepy) said : #5

Thanks for jduriez's advice and Christian's patience.

I modify my scons-profile.. file on my yade/ folder and specify as a feature qt4. Just add the line:features='qt4'
Then I run the examples.

kinn@kinn-desktop:~/YADE/bin$ yade-0.60.3 mill.py
yade-0.60.3:找不到命令(command not found)

kinn@kinn-desktop:~/YADE/bin$ python yade-0.60.3 mill.py
Welcome to Yade 0.60.3
TCP python prompt on localhost:9000, auth cookie `caskue'
XMLRPC info provider on http://localhost:21000
Running script mill.py
646 WARN yade.SpherePack /home/kinn/yade-0.60.3/pkg/dem/SpherePack.cpp:156 makeCloud: Exceeded 1000 tries to insert non-overlapping sphere to packing. Only 367 spheres was added, although you requested 707
668 WARN yade.SpherePack /home/kinn/yade-0.60.3/pkg/dem/SpherePack.cpp:156 makeCloud: Exceeded 1000 tries to insert non-overlapping sphere to packing. Only 327 spheres was added, although you requested 707
Numer of grains 694
[[ ^L clears screen, ^U kills line. F12 controller, F11 3d view, F10 both, F9 generator, F8 plot. ]]
Yade [1]:

Then it works.But when I run the example of funnel.py,there are other problems.

kinn@kinn-desktop:~/YADE/bin$ python yade-0.60.3 funnel.py
Welcome to Yade 0.60.3
TCP python prompt on localhost:9000, auth cookie `ekdssc'
XMLRPC info provider on http://localhost:21000
Running script funnel.py
Traceback (most recent call last):
  File "yade-0.60.3", line 152, in runScript
    execfile(script,globals())
  File "funnel.py", line 29, in <module>
    VTKRecorder(iterPeriod=100,recorders=['spheres','facets','colors'],fileName='/tmp/p1-')
NameError: name 'VTKRecorder' is not defined
[[ ^L clears screen, ^U kills line. F12 controller, F11 3d view, F10 both, F9 generator, F8 plot. ]]
Yade [1]:

So how to solve the problems?
Thanks for your guidance.It helps me a lot.

Do you really need to make funnel.py work or are you trying random scripts?
In the first case, you need to recompile with "vtk" in features.

Jack Wang (songjiepy) said : #7

Thanks Chareyre, that solved my question.