[Tutor] Shelve

Sander Sweers sander.sweers at gmail.com
Thu Feb 11 18:15:40 CET 2010


On do, 2010-02-11 at 10:09 -0600, Randy Raymond wrote:
> I am running Python 2.6.4 under Windows Vista 32-bit Home Edition.
> When I run:
>  
> import shelve
> test=shelve.open("myTest.fil")

And to shich directory does this file get written? I suspect you are
writing to a protected directory. When no path is given it will be
written to the current directory, check with the os module where this
is.

  import os, shelve
  print os.path.realpath(os.path.curdir)
  test=shelve.open("myTest.fil")

Better is to always pass a full path like, 'C:\\Users\\<your username\
\My Documents\\myTest.fil' to prevent surprises.

> I get a DCPermissionerror exception.  I am an administrator on this
> machine (it is my home PC).  Python and Pythonw are both allowed
> exceptions to the Windows firewall.  I tried turning the Windows
> Firewall completely off, but that does not help.  Any ideas?  

It is *always* helpful to provide the full error message.

Greets
Sander




More information about the Tutor mailing list