Replit DB raises KeyError for a key that exists

In my script, when I try to get the value of a certain key in my database, I receive a KeyError no matter what the key is. I’ve been having this problem on multiple Repls, the link is below.

Repl link:

db[''] = ""

This script returns this:

Traceback (most recent call last):
  File "", line 140, in <module>
  File "/home/runner/pysearch/venv/lib/python3.8/site-packages/replit/database/", line 439, in __getitem__
    raw_val = self.get_raw(key)
  File "/home/runner/pysearch/venv/lib/python3.8/site-packages/replit/database/", line 479, in get_raw
    raise KeyError(key)
KeyError: ''

Please help, thanks!

This is a slight limitation of the implementation of ReplDB, keys are just endpoints to the database url. This means you can’t access keys with /s in them. I’d suggest URL encoding your keys.


Alright, thank you so much!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.