Skip to content

Chapter 13 - error: db type could not be determined #71

@0bi0n3

Description

@0bi0n3

For anyone else who might encounter this issue who is using Python 3.13 and macOS.

In Chapter 13, under section Shelve, you may encounter the following error:
error: db type could not be determined

and in the subsequent cell:
NameError: name 'db' is not defined

FIX is to amend the following cell:

import shelve

db = shelve.open(db_file, 'c')
db

To this:

import shelve
import os

db = shelve.open(db_file, 'n', writeback=False)
db

Following the official Python docs for shelve.open

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions