Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6804691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:29:51+00:00 2026-05-26T19:29:51+00:00

I am running python 3.1.4 from macports and I am attempting to use the

  • 0

I am running python 3.1.4 from macports and I am attempting to use the shelve module here. I can use it successfully on another dev. machine (different OS, etc.) so I am not sure what I may be doing incorrectly…

Any thoughts or suggestions would be greatly appreciated!

Here is the error
“dbm.error: db type could not be determined”
(I searched for the error message but found no info – I even tried to force the protocl=2 to see if that might help but it did not)

Here’s the interactive session:

Python 3.1.4 (default, Oct  7 2011, 15:58:53) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
>>> import shelve
>>> a = [1, 2, 3]
>>> locker = shelve.open('myshelf',protocol=2)
>>> locker['a'] = a
>>> locker.close()
>>> exit()


Python 3.1.4 (default, Oct  7 2011, 15:58:53) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
>>> import shelve
>>> locker = shelve.open('myshelf',protocol=2)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/shelve.py", line 231, in open
    return DbfilenameShelf(filename, flag, protocol, writeback)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/shelve.py", line 215, in __init__
    Shelf.__init__(self, dbm.open(filename, flag), protocol, writeback)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/dbm/__init__.py", line 84, in open
    raise error[0]("db type could not be determined")
dbm.error: db type could not be determined
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T19:29:51+00:00Added an answer on May 26, 2026 at 7:29 pm

    This looks like a bug in the MacPorts port or in Python 3. For me, your sample works with a current MacPorts Python 2.7.2 but fails with a current MacPorts Python 3.2.2 in the same way as you’ve reported. MacPorts automatically builds and includes gdbm as a database manager for Python 3 ports; for Python 2 it includes both Berkeley DB4.6 and gdbm. It looks like the MacPorts 2.7.2 is using db46 and works but 3.2.2 fails using gdbm; presumably the MacPorts 3.1 port is similar. This should be investigated further.

    Update: If you are using an up-to-date MacPorts installation, this is likely the problem reported in http://bugs.python.org/issue13007 It looks like there was a fix to support the latest gdbm 1.9 and beyond – the current MacPorts version is 1.9.1. That fix was applied after Python 3.2.2 was released (it will be in 3.2.3); the MacPorts folks should backport that to their Python ports.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried to install django db log from here https://github.com/dcramer/django-db-log , by running python
Is there any way to get the effect of running python -u from within
How do I find the full path of the currently running Python interpreter from
I am trying to SFTP from Python running on windows and installed Paramiko as
How do I get a process list of all running processes from Python, on
When running a Python program that reads from stdin, I get the following error:
I wrote a python module. Running python filename.py, only checks for syntax errors. Is
I have a problem with dbus and python. Running python from the command line,
Are there any gotchas I should be aware of when running Python scripts from
I am trying to open a JAR file from python and running into problems.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.