TypeError: write_png() takes at most 3 arguments (5 given)

Hongyi Zhao hongyi.zhao at gmail.com
Sun Mar 20 02:30:55 EDT 2016


Hi all,

I learn the DFT based the dft-book here:

http://kitchingroup.cheme.cmu.edu/dft-book/dft.html

I use anaconda, and installed the ase + pygtk as follows:

conda install -c https://conda.anaconda.org/ska pygtk
conda install -c https://conda.anaconda.org/jochym python-ase


Now, I use iptyon notebook to run the examples given by the above
dft-book.  Say, for the first example:

3.1.1 From scratch

from ase import Atoms, Atom
from ase.io import write

# define an Atoms object
atoms = Atoms([Atom('C',[0., 0.,0.]),
               Atom('O',[1.1,0.,0.])],
               cell=(10,10,10))

print 'V = {0:1.0f} Angstrom^3'.format(atoms.get_volume())

write('images/simple-cubic-cell.png', atoms, show_unit_cell=2)


For the above example, the last line of the code will failed as follows:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call 
last)
<ipython-input-10-04feb16ff13e> in <module>()
----> 1 write('images/simple-cubic-cell.png', atoms, show_unit_cell=2)

/home/werner/anaconda2/lib/python2.7/site-packages/ase/io/__init__.pyc
in write(filename, images, format, **kwargs)
    609         raise TypeError('Unknown format: "%s".' % format)
    610
--> 611     write(filename, images, **kwargs)
    612
    613

/home/werner/anaconda2/lib/python2.7/site-packages/ase/io/png.pyc in
write_png(filename, atoms, **parameters)
     47         else:
     48             atoms = atoms[0]
---> 49     PNG(atoms, **parameters).write(filename)

/home/werner/anaconda2/lib/python2.7/site-packages/ase/io/eps.pyc in
write(self, filename)
    137         self.write_header()
    138         self.write_body()
--> 139         self.write_trailer()
    140
    141     def write_header(self):

/home/werner/anaconda2/lib/python2.7/site-packages/ase/io/png.pyc in
write_trailer(self)
     37                 _png.write_png(renderer._renderer.buffer_rgba(),
     38                                renderer.width, renderer.height,
---> 39                                self.filename, 72)
     40
     41

TypeError: write_png() takes at most 3 arguments (5 given)



Any hints for this issue?

Regards
-- 
.: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :.



More information about the Python-list mailing list