This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pdsimanyi
Recipients pdsimanyi
Date 2009-05-20.22:04:18
SpamBayes Score 5.548284e-11
Marked as misclassified No
Message-id <1242857063.47.0.919073638283.issue6074@psf.upfronthosting.co.za>
In-reply-to
Content
Some source code control tools, like Perforce, by default sync files readonly, and it's useful to leave them readonly so that you can mark files changed by making them writeable even if they're not checked out (e.g. working offline). When python implicitly compiles a .py file that's readonly, it will create a .pyc file that's readonly. This would be fine, except that when the .py file changes, python *silently* refuses to overwrite a .pyc file that's readonly, even if the directory is completely writable by the user executing Python. The attached script shows this behavior. Running "python -v" will produce the following line showing this: import b # from c:\Documents and Settings\psimanyi\tmp\b.py # can't create c:\Documents and Settings\psimanyi\tmp\b.pyc And because I hoped this was a Windows-only problem, I tested on OSX (Leopard) and Ubuntu (9.10 alpha): it occurs on all three platforms. Thanks! -------------------------------- I fixed showpycreadonly.sh after attaching it, so to be sure you have the current version, it follows: rm -f [ab].py{,c} echo 'import b' > a.py echo 'print "b"' > b.py ls -l b.py python a.py ls -l b.pyc rm b.pyc chmod -w b.py python a.py ls -l b.pyc touch b.py python -v a.py 2>&1 | grep b.py
History
Date User Action Args
2009-05-20 22:04:23pdsimanyisetrecipients: + pdsimanyi
2009-05-20 22:04:23pdsimanyisetmessageid: <1242857063.47.0.919073638283.issue6074@psf.upfronthosting.co.za>
2009-05-20 22:04:21pdsimanyilinkissue6074 messages
2009-05-20 22:04:20pdsimanyicreate