[ase-users] trajectory/visualize issue
Jens Jørgen Mortensen
jensj at fysik.dtu.dk
Mon Mar 23 08:31:55 CET 2015
On 03/23/2015 02:52 AM, Tristan Maxson wrote:
> I can confirm this, but I am also not sure which is the best way to
> fix it. Jens should probably look at this as he was the one
> implementing the new Trajectory if I recall.
Should be fixed now. Thanks for the feedback.
Jens Jørgen
>
> Tristan Maxson
>
> On Sat, Mar 21, 2015 at 12:01 PM, John Kitchin
> <jkitchin at andrew.cmu.edu <mailto:jkitchin at andrew.cmu.edu>> wrote:
>
> I made a list of atoms objects to view, and I got this error:
> view(images)
> File
> "/Users/jkitchin/Dropbox/python/ase/ase/visualize/__init__.py",
> line 49, in view
> write(fd, atoms, format=format)
> File
> "/Users/jkitchin/Dropbox/python/ase/ase/io/__init__.py", line 586,
> in write
> write(filename, images, **kwargs)
> File
> "/Users/jkitchin/Dropbox/python/ase/ase/io/trajectory.py", line
> 282, in write_trajectory
> trj = TrajectoryWriter(filename, mode='w')
> File
> "/Users/jkitchin/Dropbox/python/ase/ase/io/trajectory.py", line
> 65, in __init__
> self._open(filename, mode)
> File
> "/Users/jkitchin/Dropbox/python/ase/ase/io/trajectory.py", line
> 71, in _open
> self.backend = affopen(filename, mode, tag='ASE-Trajectory')
> File "/Users/jkitchin/Dropbox/python/ase/ase/io/aff.py",
> line 69, in affopen
> return Writer(filename, mode, tag)
> File "/Users/jkitchin/Dropbox/python/ase/ase/io/aff.py",
> line 112, in __init__
> fd = open(fd, 'wb')
> TypeError: coercing to Unicode: need string or buffer, file found
>
> A fix for the issue is to add this to write_trajectory in
> ase.io.trajectory
>
> I am not sure this is the right thing to do, since a filename
> should be
> passed from ase.io.write but a file descriptor is getting sent to
> this .
>
> if isinstance(filename, file):
> filename = filename.name <http://filename.name/>
>
> alternatively to edit ase.io.__init__.py around line 576
>
> I am not sure what is best.
>
> John
>
> -----------------------------------
> Professor John Kitchin
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803 <tel:412-268-7803>
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu
>
>
> _______________________________________________
> ase-users mailing list
> ase-users at listserv.fysik.dtu.dk
> <mailto:ase-users at listserv.fysik.dtu.dk>
> https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
>
>
>
>
> _______________________________________________
> ase-users mailing list
> ase-users at listserv.fysik.dtu.dk
> https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
More information about the ase-users
mailing list