import pylab as p
p.plot( [1,2,3] )
p.savefig( 'test.ps' )
p.savefig( 'test.png' )
ls -l test.*
-rw-r--r-- 1 --- ----- 17236 Apr 13 10:32 test.png
-rw------- 1 --- ----- 8640 Apr 13 10:32 test.ps
This is with a umask of 022. It looks to me like this is caused by the ps backend creating a temp file and then moving it to the requested file name. The permissions in the /tmp directory are generally different than a normal file system.
Any thoughts on whether this is bug or not? It seems to me that using a temp file is an implementation detail and calling savefig should always create files w/ the user's permission settings.
I'm not sure how to "fix" this - the normal copy command preserves the permissions. I guess the temp file could be opened and the data read and then copied to the requested file.