473,769 Members | 1,723 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

shelve file name extention

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>.da t
and .dir.
can anyone tell me how can I force sheve module to write the db in
<filename>.di r and <filename>.da t, instead of <filename>? Do I have to
install a specific version of the python?

Thanks...
Monu
Sep 8 '08 #1
3 1188

MonuWhen I am using shelve on my local machine it generates the db
Monufile as given filename. But in another machine it's generating
Monu<filename>. dat and .dir. can anyone tell me how can I force sheve
Monumodule to write the db in <filename>.di r and <filename>.da t,
Monuinstead of <filename>? Do I have to install a specific version of
Monuthe 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
Sep 8 '08 #2
On Sep 8, 1:47*pm, s...@pobox.com wrote:
* * MonuWhen I am using shelve on my local machine it generates thedb
* * Monufile as given filename. But in another machine it's generating
* * Monu<filename>. dat and .dir. *can anyone tell me how can I force sheve
* * Monumodule to write the db in <filename>.di r and <filename>.da t,
* * Monuinstead of <filename>? Do I have to install a specific version of
* * Monuthe 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?
Sep 11 '08 #3
On Sep 8, 1:47*pm, s...@pobox.com wrote:
* * MonuWhen I am using shelve on my local machine it generates thedb
* * Monufile as given filename. But in another machine it's generating
* * Monu<filename>. dat and .dir. *can anyone tell me how can I force sheve
* * Monumodule to write the db in <filename>.di r and <filename>.da t,
* * Monuinstead of <filename>? Do I have to install a specific version of
* * Monuthe 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?
Sep 11 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
4755
by: Rami A. Kishek | last post by:
Hi - this mysterious behavior with shelve is just about to kill me. I hope someone here can shed some light. First of all, I have this piece of code which uses shelve to save instances of some class I define. It works perfectly on an old machine (PII-400) running Python 2.2.1 under RedHat Linux 8.0. When I try to run it under Python for windows ME on a P-4 1.4 GHz, however, it keeps crashing on reading from the shelved file the second...
0
2472
by: seth | last post by:
Last week I encountered an AttributeError in my unit tests that I wasn'table to catch with an "except AttributeError" statement. The problem stemmed from a class that raised an error inside __init__and defined a __del__ method to clean up resources. I then discovered asimilar problem in the shelve module. This led me to two importantdiscoveries: 1. Attributes defined in __init__ after an error is raised will not be apart of the...
0
2034
by: ex laguna | last post by:
Hi, I have ran into a problem with py2exe 0.5.0 and shelve in python 2.3.3. The script works fine standalone, but not with py2exe. Does anyone have a solution of workaround for this? Thanks much. # Begin of setup.py from distutils.core import setup import py2exe setup(console=)
0
1371
by: Ray O | last post by:
I have read a number of threads relating to problems with shelve, but I couldn't find one directly related my experience, so I would appreciate some advice. The closest one ended with a recommendation to upgrade to Python 2.3, but that, unfortunately, is out of my control. The system I use runs Python 2.2.2, and whichdb gives dbhash. The problem only occurs when serializing class instances; lists don't seem to be affected. Every time...
3
7893
by: Michele Petrazzo | last post by:
Hi, I'm trying a script on a debian 3.1 that has problems on shelve library. The same script work well on a fedora 2 and I don't know why it create this problem on debian: #extract from my code import shelve class XX: def __init__(self): self._data = shelve.open("/tmp/myfile")
6
4446
by: aomighty | last post by:
I wanted to write the following code: import shelve try: db = shelve.open(file, "r") except SomeError: print "Oh no, db not found" Only, I'm not sure what SomeError should be. I tried error, anydbm.error, shelve.open.anydb.error, etc. but can't find it. Things
13
6517
by: 7stud | last post by:
test1.py: -------------------- import shelve s = shelve.open("/Users/me/2testing/dir1/aaa.txt") s = "red" s.close() --------output:------ $ python test1.py
5
1645
by: gluckj | last post by:
Hi, I'm not a Win ME fan myself (I'm a Mac user), but I'm here in Thailand developing software for special-needs kids, and the test PC in my home office is a Win ME machine (sigh). So when I ported my Python program today to the PC, it quickly crashed. Everything seems to work except for shelve. Using the latest version of Python (2.5.1), when I do the following in IDLE on the Win ME machine here's the result: Python 2.5.1...
2
2178
by: hypermonkey2 | last post by:
Hi there! I am using the "shelve" module in a script to save information in between runtime sessions of the program. (its a sort of data collector, so its important to hold on to anything computed ). In any case, I shelve into a file "test.txt". I notice that when i try running the program on a different computer (by either emailing or transfering the file "test.txt" via USB key), the program is unable to load the shelve file. What can...
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10211
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10045
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9863
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3958
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.