Bug 132074 - python shelve don't work - missing dbm module
Summary: python shelve don't work - missing dbm module
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: sdk (show other bugs)
Version:
(earliest affected)
6.3.5.2 release
Hardware: All All
: medium enhancement
Assignee: Xisco Faulí
URL:
Whiteboard: target:26.2.0
Keywords:
Depends on:
Blocks: Macro-Python
  Show dependency treegraph
 
Reported: 2020-04-12 19:20 UTC by edil
Modified: 2025-10-29 17:59 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description edil 2020-04-12 19:20:37 UTC
Description:
in LibreOffice python-core-3.5.9 is missing dbm module, so shelve.py don't work. It is simple to fix.

Steps to Reproduce:
1.import shelve
2.shelf = shelve.open('MyFile')
3.

Actual Results:
don't work

Expected Results:
exit def


Reproducible: Always


User Profile Reset: No



Additional Info:
add dbm module to C:\Program Files\LibreOffice\program\python-core-3.5.9\lib
Comment 1 Julien Nabet 2020-04-13 15:33:14 UTC
Michael: thought you might be interested in this one.
It reminds me tdf#130404 but not sure it's the same pb (and so the same kind of patch).
Comment 2 edil 2020-04-13 17:53:42 UTC
yes, the problem is similar, in this case that module "dbm" is missing from the python version python-core-3.5.9 files that are embedded in the Windows LibreOffice 6.3.5.2 distribution, it is import from shelve.py and so it don't work.
Comment 3 Michael Stahl 2020-04-14 09:45:48 UTC
comment in ExternalPackage_python3.mk:

# packages not shipped:
# dbm, sqlite3 - need some database stuff
# curses - need curses to build the C module
# idlelib, tkinter, turtledemo - need Tk to build the C module
# test - probably unnecessary? was explicitly removed #i116738#
# venv - why would we need virtual environments

this indicates that dbm is deliberately disabled because it has runtime dependencies that we don't want to spend the effort to bundle with LO.

hence i think this is WONTFIX.
Comment 4 Julien Nabet 2020-04-14 09:54:14 UTC
(In reply to Michael Stahl (CIB) from comment #3)
> comment in ExternalPackage_python3.mk:
> 
> # packages not shipped:
> # dbm, sqlite3 - need some database stuff
> # curses - need curses to build the C module
> # idlelib, tkinter, turtledemo - need Tk to build the C module
> # test - probably unnecessary? was explicitly removed #i116738#
> # venv - why would we need virtual environments
> 
> this indicates that dbm is deliberately disabled because it has runtime
> dependencies that we don't want to spend the effort to bundle with LO.
> 
> hence i think this is WONTFIX.

Dumb me! I hadn't thought about checking "dbm" in the file.
Sorry for the noise Michael!
Comment 5 edil 2020-04-14 10:51:26 UTC
Thank you, now it is clear.
May should be better don't have shelve in LibreOffice distribution, remove shelve from distribution so a user know that can't use it.
By
Comment 6 Michael Stahl 2020-04-16 14:41:39 UTC
(In reply to edil from comment #5)
> Thank you, now it is clear.
> May should be better don't have shelve in LibreOffice distribution, remove
> shelve from distribution so a user know that can't use it.

possibly ...

it looks like there's a class BsdDbShelf(Shelf) and a class DbfilenameShelf(Shelf) and only the latter imports dbm so the module looks useful (with reduced functionality) without dbm.
Comment 7 Xisco Faulí 2025-10-29 17:09:41 UTC
Reopening this one. I just submitted a patch for bug 168512 where sqlite3 is bundled with the internal python. This one can be bundled as well. Taking
Comment 8 Commit Notification 2025-10-29 17:59:16 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/3d57e6a9b5cdfa5b8912828de2caef0026fa912a

tdf#132074: python3: bundle dbm

It will be available in 26.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.