473,771 Members | 2,357 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

error: db type could not be determined

why does the following error occur?

def quit_time():
data_file = shelve.open("da ta.dat", "c")
data_file["quit_time"] = datetime.dateti me.today()
print data_file["quit_time"]
raw_input("ente r")
Traceback (most recent call last):
File "D:\a\TEXT\Py\g oing_over\going _over.py", line 192, in -toplevel-
main()
File "D:\a\TEXT\Py\g oing_over\going _over.py", line 190, in main
quit_time()
File "D:\a\TEXT\Py\g oing_over\going _over.py", line 156, in quit_time
data_file = shelve.open("da ta.dat", "c")
File "D:\A\UTILITIES \PYTHON\PYTHON2 3J\lib\shelve.p y", line 231, in
open
return DbfilenameShelf (filename, flag, protocol, writeback, binary)
File "D:\A\UTILITIES \PYTHON\PYTHON2 3J\lib\shelve.p y", line 212, in
__init__
Shelf.__init__( self, anydbm.open(fil ename, flag), protocol,
writeback, binary)
File "D:\A\UTILITIES \PYTHON\PYTHON2 3J\lib\anydbm.p y", line 80, in
open
raise error, "db type could not be determined"
error: db type could not be determined

Jul 18 '05 #1
1 5921

ne********@myre albox.com wrote:
why does the following error occur?


I don't know; I've never used the shelve module. Let's see what as two
utter n00bz we can find out. Let's check out where it clagged:
lib\anydbm.py, line 80, in open ...

Hmm, reading backwards a little, looks like it called whichdb.whichdb
to nut out what sort of database it was, and whichdb reported back that
it was an existing file, of unknown type. Flicking through whichdb.py
confirms this.

Let's see if we can reproduce that:

=== step 1: file doesn't exist ===
C:\junk>c:\pyth on23\python
Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)]
on win32
Type "help", "copyright" , "credits" or "license" for more information.
import shelve
df = shelve.open('my data.dat', 'c')
^Z
C:\junk>dir mydata.dat
[snip]
26/02/2005 08:40p 24,576 mydata.dat

=== looks like file created OK ==

C:\junk>del mydata.dat
C:\junk>copy con mydata.dat
any old codswallop
^Z
1 file(s) copied.

=== OK, now mydata.dat is trash.

C:\junk>c:\pyth on23\python
Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)]
on win32
Type "help", "copyright" , "credits" or "license" for more information. import shelve
df = shelve.open('my data.dat', 'c') Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "c:\python23\li b\shelve.py", line 231, in open
return DbfilenameShelf (filename, flag, protocol, writeback, binary)
File "c:\python23\li b\shelve.py", line 212, in __init__
Shelf.__init__( self, anydbm.open(fil ename, flag), protocol,
writeback, binary)
File "c:\python23\li b\anydbm.py", line 80, in open
raise error, "db type could not be determined"
anydbm.error: db type could not be determined


Uh-huh.

By the way, it's probably not a good idea to use a ".dat" extension;
evidently (read whichdb.py for the gory details) some of the dbms add
an extension to the supplied name. One of them uses ".dat". Could
become a source of confusion.

Take a hint: they say "Google is your friend", but better still is the
source in lib\*.py -- it's quite legible, you don't need an Internet
connection, and there sure ain't no ads in the margin. And don't just
open it in emergencies: pick a module that covers a topic that
interests you and just read it. You'll see good coding style, good ways
of doing things, wise utterances by the timbot, ...

HTH,
John

Jul 18 '05 #2

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

Similar topics

11
3492
by: ColdCanuck | last post by:
Greetings! I am VERY new to DB2 but not Orable, Sybase and SQL Server. I am trying to call a stored procedure via VB 6 and ADO/OLEDB. But when I try to execute
51
4564
by: jacob navia | last post by:
I would like to add at the beginning of the C tutorial I am writing a short blurb about what "types" are. I came up with the following text. Please can you comment? Did I miss something? Is there something wrong in there? -------------------------------------------------------------------- Types A type is a definition for a sequence of storage bits. It gives the meaning of the data stored in memory. If we say that the object a is an
33
1671
by: nkhan | last post by:
Need some help on this please: EECE1207 Spring 2005 Computer Assignment # 1 Due Wednesday, March 23rd The file ‘grades.txt’, as shown below, contains the results of a true-false exam given to a group of students. You may assume that the
3
2135
by: Benedikt Weber | last post by:
I found the following compiler error with Microsoft Visual C++ .NET. I use different functions with return types determined by a Traits class. Function g() below works ok, but when I put the two declarations f1() and f2(), the compiler gets disturbed. The error message does not even reproduce the original code correctly. When the two declarations are switched, the problem goes away. Benedikt
4
436
by: MSNews | last post by:
I get the following exception when calling Dns.GetHostName (from C#): An unhandled exception of type 'System.Net.Sockets.SocketException' occurred in system.dll Additional information: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full This exception is then followed with the following exception: An unhandled exception of type 'System.TypeInitializationException'...
669
26211
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic paper written on this subject. On the Expressive Power of Programming Languages, by Matthias Felleisen, 1990. http://www.ccs.neu.edu/home/cobbe/pl-seminar-jr/notes/2003-sep-26/expressive-slides.pdf
3
4332
by: Olav | last post by:
Hi all, I can not install CF 2.0 SP 1 on an Symbol PPT8800 running WinCE 4.2. The Install-Log say's cgacutil.exe failed with exit-code 80000004 and I get a messagebox indicating a support-Info '3'. This would mean I would not have enough space on my device. But I hard-reseted it befor I tryed to install and I have no other processes running while installing. Any ideas, whats going wrong???
5
3416
by: jhurrell | last post by:
I have been having some trouble getting my XSL style sheet to parse correctly. I have some XML outputted from an SQL-Server, that I then need to turn into multiple HTML files. This I have done with moderate success using Saxon and <xsl:result-document>, but Saxon is throwing an error and I don't know how to resolve it. Maybe someone can offer some advice? This is a long question, for which I apologise... OS= Windows XP Pro, Saxon=8.8 XML...
13
6518
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
0
9619
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
10260
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
10102
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
9910
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
8933
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7460
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6712
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.