Ask coding questions

← Back to all posts
replit database value int instead of string
Kingq23 (38)

is it possible and if not is there another way to get around this.

ch1ck3n (2077)

db["whatever"] = str(8)
print(int(db["whatever"]) + 38)

the str( ) function converts it to a string, and the int() function coverts to a int

Kingq23 (38)

@ch1ck3n then what am I doing wrong

Ignoring exception in on_message
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/", line 343, in _run_event
await coro(*args, **kwargs)
File "", line 19, in on_message
cur_mon = int(db[])
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/replit/database/", line 432, in getitem
raw_val = self.get_raw(key)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/replit/database/", line 470, in get_raw
r = self.sess.get(self.db_url + "/" + urllib.parse.quote(key))
File "/usr/lib/python3.8/urllib/", line 851, in quote
return quote_from_bytes(string, safe)
File "/usr/lib/python3.8/urllib/", line 876, in quote_from_bytes
raise TypeError("quote_from_bytes() expected bytes")
TypeError: quote_from_bytes() expected bytes

ch1ck3n (2077)

@qadams2008 ya first gotta make your repl public