Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > shelve file name extention

Reply
Thread Tools

shelve file name extention

 
 
Monu
Guest
Posts: n/a
 
      09-08-2008
Hi All,
When I am using shelve on my local machine it generates the db file as
given filename. But in another machine it's generating <filename>.dat
and .dir.
can anyone tell me how can I force sheve module to write the db in
<filename>.dir and <filename>.dat, instead of <filename>? Do I have to
install a specific version of the python?

Thanks...
Monu
 
Reply With Quote
 
 
 
 
skip@pobox.com
Guest
Posts: n/a
 
      09-08-2008

Monu> When I am using shelve on my local machine it generates the db
Monu> file as given filename. But in another machine it's generating
Monu> <filename>.dat and .dir. can anyone tell me how can I force sheve
Monu> module to write the db in <filename>.dir and <filename>.dat,
Monu> instead of <filename>? Do I have to install a specific version of
Monu> the python?

Shelve is just a thin layer on top of a concrete db file module. Sounds
like on your two machines there are different underlying db file modules
available. You're pretty much at the mercy of those modules as to file
naming. All you are giving it when opening a shelve file is the prefix.

Skip
 
Reply With Quote
 
 
 
 
Monu
Guest
Posts: n/a
 
      09-11-2008
On Sep 8, 1:47*pm, (E-Mail Removed) wrote:
> * * Monu> When I am using shelve on my local machine it generates the db
> * * Monu> file as given filename. But in another machine it's generating
> * * Monu> <filename>.dat and .dir. *can anyone tell me how can I force sheve
> * * Monu> module to write the db in <filename>.dir and <filename>.dat,
> * * Monu> instead of <filename>? Do I have to install a specific version of
> * * Monu> the python?
>
> Shelve is just a thin layer on top of a concrete db file module. *Sounds
> like on your two machines there are different underlying db file modules
> available. *You're pretty much at the mercy of those modules as to file
> naming. *All you are giving it when opening a shelve file is the prefix..
>
> Skip


Thanks Skip.
So Can't I choose which module to use. Is there any preferance on
which shelve chooses these modules?
 
Reply With Quote
 
Monu
Guest
Posts: n/a
 
      09-11-2008
On Sep 8, 1:47*pm, (E-Mail Removed) wrote:
> * * Monu> When I am using shelve on my local machine it generates the db
> * * Monu> file as given filename. But in another machine it's generating
> * * Monu> <filename>.dat and .dir. *can anyone tell me how can I force sheve
> * * Monu> module to write the db in <filename>.dir and <filename>.dat,
> * * Monu> instead of <filename>? Do I have to install a specific version of
> * * Monu> the python?
>
> Shelve is just a thin layer on top of a concrete db file module. *Sounds
> like on your two machines there are different underlying db file modules
> available. *You're pretty much at the mercy of those modules as to file
> naming. *All you are giving it when opening a shelve file is the prefix..
>
> Skip


Thanks Skip.
So Can't I choose which module to use. Is there any preferance on
which shelve chooses these modules?
 
Reply With Quote
 
Fredrik Lundh
Guest
Posts: n/a
 
      09-11-2008
Monu wrote:

> So Can't I choose which module to use. Is there any preferance on
> which shelve chooses these modules?


it uses the anydbm module to look for available DBM-style drivers, which
looks for modules in the following order: dbhash, gdbm, dbm, dumbdbm.

if you know which one you want, you can open the database file yourself,
and pass it to the Shelf constructor:

import shelve
import somedbm

db = shelve.Shelf(somedbm.open(file, flag))

</F>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
change file extention Howard ASP .Net 2 01-05-2006 01:54 PM
How to get file extention from Content-type. shilpa Java 3 06-30-2005 11:05 AM
Strange file extention help Joni Computer Support 4 03-22-2005 06:27 PM
G/H/Y mail Notifier Extention Cron Firefox 4 01-26-2005 03:42 PM
Get file extention from path Ron Perl Misc 5 07-22-2003 07:22 PM



Advertisments