[ase-users] writing lammps-data and python 3.7

James Kermode james.kermode at gmail.com
Fri Feb 28 09:59:53 CET 2020


Hi Noam

I’ve had this problem the other way round, when trying to write text strings to a file that was open in ‘wb’ mode - this was using ase.io <http://ase.io/>.castep writer with a NamedTemporaryFile, which was defaulting to ‘wb’ mode; for me, explicitly opening the file with ‘w’ and passing the open file instead of the filename solved the problem. Presumably lammps-data should also be a plain text format so something similar might work.

James

> On 27 Feb 2020, at 20:32, Noam Bernstein via ase-users <ase-users at listserv.fysik.dtu.dk> wrote:
> 
> Has anyone tried writing lammps-data file with python 3.7?  Before I open an issue, I'm trying to understand if I'm just missing something.  I get the error 
> TypeError: write() argument must be str, not bytes
> which the internet suggests is caused by the file object not being opened with "wb".  Poking around ase.io <http://ase.io/> I get the impression that it's being specifically opened with "wt".  
> 
> Does anyone know that code and have any idea whether this is a python issue or a genuine ASE bug?
> 
> 								Noam
> 
> _______________________________________________
> ase-users mailing list
> ase-users at listserv.fysik.dtu.dk
> https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20200228/4e5c8fc3/attachment-0001.html>


More information about the ase-users mailing list