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.

Error when loading database file

See original GitHub issue

When using the example code in Python 3.8 i get this error :

Traceback (most recent call last):
  File "C:/Users/loicn/backend_db.py", line 7, in <module>
    db = connection.my_tiny_database
  File "C:\Users\loicn\AppData\Local\Programs\Python\Python38\lib\site-packages\tinymongo\tinymongo.py", line 73, in __getattr__
    return TinyMongoDatabase(name, self._foldername, self._storage)
  File "C:\Users\loicn\AppData\Local\Programs\Python\Python38\lib\site-packages\tinymongo\tinymongo.py", line 73, in __getattr__
    return TinyMongoDatabase(name, self._foldername, self._storage)
  File "C:\Users\loicn\AppData\Local\Programs\Python\Python38\lib\site-packages\tinymongo\tinymongo.py", line 73, in __getattr__
    return TinyMongoDatabase(name, self._foldername, self._storage)
  [Previous line repeated 996 more times]
RecursionError: maximum recursion depth exceeded

Process finished with exit code 1

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:4
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
jefmudcommented, Jun 18, 2020

I have used this extensively-- so I have a high level of confidence it works and will continue to work even if Schapman upgrades the code.

Make sure you are importing tinymongo and tinydb. In this case we are “overriding” the TinyMongoClient class property import to ensure we have the correct return. It might look a little awkward, but it achieves the same effect as Conner Boyle’s fork (Thank you David Lai for pointing this out)

######### code starts here import tinymongo as tm import tinydb class TinyMongoClient(tm.TinyMongoClient): @property def _storage(self): return tinydb.storages.JSONStorage ############ code ends here

ALTERNATELY… You could just work with the forked version from Conner Boyle’s github repository.

$ pip uninstall tinymongo $ pip install git+https://github.com/cjboyle/tinymongo

The only “gotcha” of doing it this way is that you cannot uninstall CJBoyle’s version with a “pip uninstall”, you have to remove it the old fashioned way of going into the environment packages and deleting the directory.

On Wed, Jun 17, 2020 at 2:59 PM Selwyn-Lloyd McPherson < notifications@github.com> wrote:

I actually got this on 3.7.6 The class TinyMongoClient(tm.TinyMongoClient) solution didn’t seem to work for me, but I can’t 100% ensure that I didn’t mess something else up 😃

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/schapman1974/tinymongo/issues/58#issuecomment-645561061, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA6KUBCOTUYWTKDVDZFO3MLRXEHBDANCNFSM4M75KOOQ .

– Jeff Muday Instructional Technology Analyst Wake Forest University 1834 Wake Forest Rd. Winston Hall Rm. 27 Winston Salem, NC 27106 mudayja @ wfu . edu p 336.758.6171 f 336.758.6004

1reaction
JRileyHcommented, Nov 14, 2021

How would one support custom serialization such as the DateTimeSerializer provided with tinymongo using this work around? The suggested method of supporting datetime objects in tinymongo already overrides this property:

import tinydb
from tinydb_serialization import SerializationMiddleware
import tinymongo as tm

class TinyMongoClient(tm.TinyMongoClient):
    @property
    def _storage(self):
        serialization = SerializationMiddleware()
        serialization.register_serializer(tm.serializers.DateTimeSerializer(), 'TinyDate')
        return serialization
Read more comments on GitHub >

github_iconTop Results From Across the Web

"An error occurred while opening the database file. ...
"An error occurred while opening the database file. The database may be corrupted or you may be out of hard disk space.
Read more >
Access Database Error in Loading DLL – Easy Solutions
The error usually occurs due to missing, corrupted, or outdated Microsoft Data Access Components (MDAC) files. Some other reasons that may cause ...
Read more >
Error in Access when opening a database on a network file ...
When opening a database on a network file share, or with links to another database on a network file share, you may receive...
Read more >
5 Instant Fixes To Resolve Access 3045-“Couldn't Use Database
One of the most common reasons behind this MS Access “Could Not Use Database; File Already in Use” Error can also be the...
Read more >
How To Fix The "Error Establishing a Database Connection ...
The first thing to do is check to ensure your database login credentials are correct. This is by far the most common reason...
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