question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot use shelve without manual import of dbm.dumb

See original GitHub issue

python -m nuitka --version

0.7.5
Commercial: None
Python: 3.8.12 (heads/master:bd5e0bb, Aug 31 2021, 10:21:45) [MSC v.1929 64 bit (AMD64)]
Flavor: Unknown
Executable: C:\Users\<user>\AppData\Local\Programs\Python\Python38\python.exe
OS: Windows
Arch: x86_64
WindowsRelease: 10

Nuitka was installed using pip. Python was installed using the binary installer.

import shelve

pConfig = shelve.open("config")
pConfig.close()

Compiling the above code example with the following options:

python -m nuitka --standalone --follow-imports test.py

yields the following output when executing the binary:

Traceback (most recent call last):
  File "C:\Users\<user>\nuitkaTest\test.py", line 3, in <module>
  File "C:\Users\<user>\nuitkaTest\shelve.py", line 243, in open
  File "C:\Users\<user>\nuitkaTest\shelve.py", line 226, in __init__
ModuleNotFoundError: No module named 'dbm'

Using the current develop version of nuitka (0.8rc6) yields the same error.

If I add import dbm in front of import shelve, I get an error saying it couldn’t find any implementation of dbm (neither dbm.gnu, nor dbm.ndbm, nor dbm.dumb) If I add import dbm.dumb it works fine.

Nuitka version 0.6.19.7 worked perfectly fine.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
kayhayencommented, Apr 29, 2022

This is now on develop and will be in 0.8 release.

0reactions
kayhayencommented, May 20, 2022

Part of 0.8 release that I just made.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Convert Python shelve from dbm.gnu to dbm.dumb
I am trying to convert data stored in a non-dumb shelve to a dumb shelve, to be able to ...
Read more >
dbm — Interfaces to Unix “databases” — Python 3.11.1 ...
Returns one of the following values: None if the file can't be opened because it's unreadable or doesn't exist; the empty string (...
Read more >
11.4. shelve — Python object persistence
A “shelf” is a persistent, dictionary-like object. The difference with “dbm” databases is that the values (not the keys!) in a shelf can...
Read more >
Python - Database Manager (dbm) package - GeeksforGeeks
This function is used to open a dbm database or create a new database if not exist. Syntax: dbm.open(file, flag='r', mode=0o666). Parameters: ...
Read more >
Chapter 16. Databases and Persistence
So far in this book, we've used Python in the system programming, GUI development, and Internet ... Shelve files: storing pickled objects in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found