← Back to team overview

yade-users team mailing list archive

Re: [Question #701519]: Import packing text file into yade

 

Question #701519 on Yade changed:
https://answers.launchpad.net/yade/+question/701519

Jan Stránský proposed the following answer:
Hello,

please provide a MWE [1]:
W = working, i.e. also with the saving part, such that we can test it ourselves
M = minimal, i.e. flow stuff is irrelevant to the expory / import error

Also provide Yade version ...

> I used yade.export.text('filename.txt', mask=-1)
> ValueError: could not convert string to float: '0.42264,0.478226,0.889397,0.115182'

... because in yade I am using, export.text saves file with tabs, not commas.
ymport.text expects the same format (tabs/spaces, not commas)
Have you modified the exported file in the meantime before ymport.text?

> I used O.bodies.append(ymport.text('final.txt',format='x_y_z_r')) and I got this error:
> TypeError: textExt() got multiple values for keyword argument 'format'

Either use
ymport.text(fileName) # [2]
or
ymport.textExt(filename,format=...) # [3]
not
ymport.text(fileName,format=...)
(ymport.text calls ymport.textExt internally and does not expect format parameter)

Cheers
Jan

[1] https://www.yade-dem.org/wiki/Howtoask
[2] https://yade-dem.org/doc/yade.ymport.html#yade.ymport.text
[3] https://yade-dem.org/doc/yade.ymport.html#yade.ymport.textExt

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.