number minimal of argument for export data
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Yade |
New
|
Undecided
|
Unassigned |
Bug Description
Hello,
I encounter an anomaly in the export.textExt () function
When I give in parameter That a single argument, I have an execution error.
i have to passed two argument minimum for not have of error
see example below :
=======
EXAMPLE 1 : with error
=======
export.
=======
Exportation des données en cours...
-------
SyntaxError Traceback (most recent call last)
/soft/yade/
/soft/yade/
52 # export.
53 # export.
---> 54 export.
55
56 def testcode():
/soft/yade/
56 output+
57 for cmd in attrs:
---> 58 v = eval(cmd)
59 if isinstance(
60 output+='\t%g'%v
SyntaxError: unexpected EOF while parsing (<string>, line 1)
=======
EXAMPLE 2 : with error
=======
export.
=======
Exportation des données en cours...
-------
SyntaxError Traceback (most recent call last)
/soft/yade/
/soft/yade/
52 # export.
53 # export.
---> 54 export.
55
56 def testcode():
/soft/yade/
56 output+
57 for cmd in attrs:
---> 58 v = eval(cmd)
59 if isinstance(
60 output+='\t%g'%v
SyntaxError: unexpected EOF while parsing (<string>, line 1)
=======
EXAMPLE 3,4 and 5 : no error
=======
export.
=======
#format x_y_z_r_attrs
0.336553 0.0248906 -0.835412 0.02 0.336553 0.0248906 -0.835412 1 0 1
-0.318431 -0.174808 -0.780485 0.02 -0.318431 -0.174808 -0.780485 1 0 1
0.232435 -0.145611 -0.799793 0.02 0.232435 -0.145611 -0.799793 1 0 1
0.169229 -0.38806 -0.784145 0.02 0.169229 -0.38806 -0.784145 1 0 1
-0.120705 -0.213641 -0.738489 0.02 -0.120705 -0.213641 -0.738489 1 0 1
-0.243449 -0.293311 -0.784106 0.02 -0.243449 -0.293311 -0.784106 1 0 1
=======
export.
=======
#format x_y_z_r_attrs
0.124342 -0.423004 -0.650883 0.02 1 0 1 0
-0.0990602 -0.201278 -0.747631 0.02 1 0 1 0
0.0408943 -0.36283 -0.695135 0.02 1 0 1 0
0.146338 -0.411332 -0.784349 0.02 1 0 1 0
-0.0313473 -0.190286 -0.749565 0.02 1 0 1 0
0.134005 -0.431563 -0.748373 0.02 1 0 1 0
0.192398 -0.0521496 -0.806122 0.02 1 0 1 0
=======
export.
=======
#format x_y_z_r_attrs
-0.0663139 -0.282156 -0.724299 0.02 1 0 1 0 -0.0663139 -0.282156 -0.724299
0.441224 0.112877 -0.902508 0.02 1 0 1 0 0.441224 0.112877 -0.902508
0.166181 -0.275276 -0.754 0.02 1 0 1 0 0.166181 -0.275276 -0.754
0.172778 -0.385368 -0.755037 0.02 1 0 1 0 0.172778 -0.385368 -0.755037
0.107078 -0.371537 -0.688094 0.02 1 0 1 0 0.107078 -0.371537 -0.688094
0.0671631 -0.500364 -0.742586 0.02 1 0 1 0 0.0671631 -0.500364 -0.742586
-0.341773 -0.296308 -0.76077 0.02 1 0 1 0 -0.341773 -0.296308 -0.76077
0.133467 -0.384747 -0.747603 0.02 1 0 1 0 0.133467 -0.384747 -0.747603
Alexandre,
Hi Alexander,
the problem is hidden in python syntax. The 'attrs' argument should be a
list or tuple. So if you use
export. textExt( '../../ tmp/data_ export_ melangeur. txt',format= 'x_y_z_ r_attrs' ,attrs= ('
b.mat.id',)) # notice the comma, making ('b.mat.id',) actually a tuple, ('
b.mat.id') is just one string
it should work
cheers
Jan
2015-02-10 12:37 GMT+01:00 Alex <email address hidden>:
> Public bug reported: ======= ======= ======= ======= ======= ======= ======= ======= ======= ======= ======= ======= ======= ===== ======= ======= ======= ======= ======= ======= ======= ======= ======= ======= ======= ======= ======= ===== textExt( '../../ tmp/data_ export_ melangeur. txt',format= 'x_y_z_ r_attrs' ,attrs= (' ======= ======= ======= ======= ======= ======= ======= ======= ======= ======= ======= ======= ======= ===== ------- ------- ------- ------- ------- ------- ------- ------- ------- ----- 1.12.0/ gcc/4.4. 7/bin/yade- 1.12.0 in <module>() 1.12.0/ gcc/4.4. 7/bin/yade- 1.12.0 in ExportData() textExt( '../../ tmp/data_ export_ melangeur. txt',format= 'x_y_z_ r_matId' ,attrs= ('b.mat. label') ) textExt( '../../ tmp/data_ export_ melangeur. txt',format= 'x_y_z_ r_attrs' ,attrs= ('b.shape. color', 'b.state. pos' textExt( '../../ tmp/data_ export_ melangeur. txt',format= 'x_y_z_ r_attrs' ,attrs= (' 1.12.0/ gcc/4.4. 7/lib64/ yade-1. 12.0/py/ yade/export. pyc in =('%g\t% g\t%g\t% g'%(b.state. pos[0], b.state. pos[1], b.state. pos[2], b.shape. radius) ) v,(int, float)) : ======= ======= ======= ======= ======= ======= ======= ======= ======= ======= ======= ======= ======= ===== ======= ======= ======= ======= ======= ======= ======= ======= ======= ======= ======= ======= ======= ===== textExt( '../../ tmp/data_ export_ melangeur. txt',format= 'x_y_z_ r_attrs' ,attrs= ('b.shape. color') ) ======= ======= ======= ======= ======= ======= ======= ======= ======= ======= ======= ======= ======= ===== ------- ------- ------- ------- ------- ------- ------- ------- ------- ----- 1.12.0/ gcc/4.4. 7/bin/yade- 1.12.0 in <module>() 1.12.0/ gcc/4.4. 7/bin/yade- 1.12.0 in ExportData()
>
> Hello,
>
>
> I encounter an anomaly in the export.textExt () function
> When I give in parameter That a single argument, I have an execution
> error.
> i have to passed two argument minimum for not have of error
>
> see example below :
>
>
> =======
> EXAMPLE 1 : with error
>
> =======
>
> export.
> b.mat.id'))
>
> =======
>
>
> Exportation des données en cours...
> -------
> SyntaxError Traceback (most recent call last)
> /soft/yade/
>
> /soft/yade/
> 52 #
> export.
> 53 #
> export.
> ))
> ---> 54
> export.
> b.mat.id'))
> 55
> 56 def testcode():
>
> /soft/yade/
> textExt(filename, format, comment, mask, attrs)
> 56
> output+
> 57 for cmd in attrs:
> ---> 58 v = eval(cmd)
> 59 if
> isinstance(
> 60
> output+='\t%g'%v
>
> SyntaxError: unexpected EOF while parsing (<string>, line 1)
>
>
>
> =======
> EXAMPLE 2 : with error
>
> =======
>
> export.
>
> =======
>
>
> Exportation des données en cours...
> -------
> SyntaxError Traceback (most recent call last)
> /soft/yade/
>
> /soft/yade/
> 52 #
> export.text...