Message88138
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 |
|
Date |
User |
Action |
Args |
2009-05-20 22:04:23 | pdsimanyi | set | recipients:
+ pdsimanyi |
2009-05-20 22:04:23 | pdsimanyi | set | messageid: <1242857063.47.0.919073638283.issue6074@psf.upfronthosting.co.za> |
2009-05-20 22:04:21 | pdsimanyi | link | issue6074 messages |
2009-05-20 22:04:20 | pdsimanyi | create | |
|