[Python-Dev] PEP 3147, pycache directories and umask (original) (raw)
Cameron Simpson cs at zip.com.au
Tue Mar 23 01:45:19 CET 2010
- Previous message: [Python-Dev] PEP 3147, __pycache__ directories and umask
- Next message: [Python-Dev] Request for commit access
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 23Mar2010 11:40, I wrote: | | * Raise an exception or refuse to create pycache if it's not writable | | (again, by whom?) || -3 | Bleah. My python program won't run because an obscure (to the user) | directory had unusual permissions?
Clarification: I'm -3 on the exception. Silent failure to make the pycache would do, and may be better than silently making a useless (unwritable) one.
How about:
made_it = False ok = False try: if not isdir(__pycache__dir): mkdir(__pycache__dir) made_it = True write pyc content ... ok = True except OSError, IOerror etc: if not ok: os.remove pyc content file if made_it: rmdir(__pycache__dir) but be quiet if this fails, eg if it is not empty because another process or thread added stuff
So silent tidyup attempt on failure, but no escaping exception.
Cheers,
Cameron Simpson <cs at zip.com.au> DoD#743 http://www.cskk.ezoshosting.com/cs/
The govt MUST regulate the Net NOW! We can't have average people saying what's on their minds! - ezwriter at netcom.com
- Previous message: [Python-Dev] PEP 3147, __pycache__ directories and umask
- Next message: [Python-Dev] Request for commit access
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]