[Pythonmac-SIG] Shelve ... Denied!

Jack Jansen Jack.Jansen at cwi.nl
Wed May 28 12:00:47 EDT 2003


On Wednesday, May 28, 2003, at 00:43 Europe/Amsterdam, Israel C. Evans 
wrote:
> here is the bit that python or maybe apache chokes on:
> db = shelve.open('200305','c')
>
> and this gives me this error (condensed due to the size of the cgitb 
> traceback info I get).
> error: (13, 'Permission denied')
>        args = (13, 'Permission denied')

This sounds like a typical unix permissions problem. Check the uiserID 
and mode on the shelve files and the userIDs that you expect to do 
updates. If there is only one userID that does updates then any mode 
that has rw-...... in the first column is okay. If there are multiple 
userIDs that do updates you need at least rw-rw-... or even rw-rw-rw-.

Hmm, shelve.open() has no direct way to set the mode, it uses rw-rw-rw- 
modified by the umask. The umask is the bits that are automatically 
taken _out_ of the modes of the files you create, and it defaults to 
octal 022 (in other words, the bits ----w--w- are taken out of your 
filemode). If you set the umask to 02 or even 0 before creating the 
file that should help.
--
Jack Jansen, <Jack.Jansen at cwi.nl>, http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma 
Goldman




More information about the Pythonmac-SIG mailing list