running .py files on Linux

Laszlo Nagy gandalf at shopzeus.com
Thu May 6 08:58:55 EDT 2010


Tingting HAN írta:
> Dear Officer,
> I want to run two .py files to generate .h5 files.
> hantingting at tityro:~$ <mailto:hantingting at tityro:%7E$> python2.5
> Python 2.5.4 (r254:67916, Jan 20 2010, 21:43:02)
> [GCC 4.4.1] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>  
> When ruuning gentest_sphere.py, the problem is as following:
> hantingting at tityro:~/Downloads/triMC3D/python$ 
> <mailto:hantingting at tityro:%7E/Downloads/triMC3D/python$> python2.5 
> gentest_sphere.py gsphere.h5
> Usage: gentest_sphere.pynEl Testfile.h5
> options:
>         n:      number of elements
> hantingting at tityro:~/Downloads/triMC3D/python$ 
> <mailto:hantingting at tityro:%7E/Downloads/triMC3D/python$>
> I guess I should write the command in the format of usage, but I don't 
> know how to do it.
>  
> When ruuning test_detector.py, the problem is as following:
> hantingting at tityro:~/Downloads/triMC3D/python$ 
> <mailto:hantingting at tityro:%7E/Downloads/triMC3D/python$> python2.5 
> test_detector.py tdetector.h5
> h5/Opaque_material/ext_Trabecular_Bone-int_Cartilage/Nonenm/SourceNone/
> lamb =  None
> Traceback (most recent call last):
>   File "test_detector.py", line 600, in <module>
>     main()
>   File "test_detector.py", line 567, in main
>     hdf5.subs_lamb( materials, lamb )
>   File 
> "/home/hantingting/Downloads/triMC3D/python/local_modules/hdf5.py", 
> line 703, in subs_lamb
>     m.mu_s = m.mu_s(l)
>   File 
> "/home/hantingting/Downloads/triMC3D/python/local_modules/matslib.py", 
> line 71, in <lambda>
>     [1550.0,1460.0,1360.0,1300.0,1240.0,1220.0,1220.0,1200.0,1160.0], 
> s=300 ))
>   File 
> "/usr/lib/python2.5/site-packages/scipy/interpolate/fitpack.py", line 
> 485, in splev
>     y,ier=_fitpack._spl_(x,der,t,c,k)
> TypeError: array cannot be safely cast to required type
> hantingting at tityro:~/Downloads/triMC3D/python$ 
> <mailto:hantingting at tityro:%7E/Downloads/triMC3D/python$> python2.5 
> test_detector.py
> usage: test_detector.py outputfile.h5 [options]
> options:
>     -c  Cage Material
>     -e  External Material
>     -i  Internal Material
>     -l  Lambda
>     -o  Output String
>     -s  Source Number
>     -h  Shows this help
> hantingting at tityro:~/Downloads/triMC3D/python$ 
> <mailto:hantingting at tityro:%7E/Downloads/triMC3D/python$>
> Could you please give me some advice to solve these two problems? I  
> sincerely apologize that I am new for python.
Did you try this:

1.)  replace the first line of gentest_sphere.py to  
"#!/usr/bin/python2.5"  (or your path to python2.5)
2.) "chmod +x gentest_sphere.py"
3.) run this:  "./gentest_sphere.py gsphere.h5"  (instead of "python2.5 
./gentest_sphere.py gsphere.h5"

It may not help. But... suspicious. You used the advertised command 
line. The program may have a bug. E.g. it uses sys.argv the incorrect way.

Best,

   Laszlo




More information about the Python-list mailing list