In python I’m doing a os.system('chmod o+w filename.png') command so I can overwrite the file with pngcrush.
These are the permissions after I set them in python:
-rw-rw-rw- 1 me users 925 Sep 20 11:25 filename.png
Then I attempt:
os.system('pngcrush filename.png filename.png')
which is supposed to overwrite the file, but I get:
Cannot overwrite input file filename.png
What could be the problem? Isn’t pngcrush being run as an ‘other’ user, for which write permissions are enabled?
Thanks!
The problem is with the way you execute the
pngcrushprogram, not with permissions offilename.pngor Python. It simply attempts to openfilename.pngboth for input and output, which is of course invalid.Give
pngcrusheither the-eor the-doption to tell it how to write output. Read itsmanfor more information.