Skip to content
Sign upLog in
← Back to Community
replit database value int instead of string
Profile icon
hacker
has Hacker Plan
Kingq23

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

Voters
Profile icon
Kingq23
Comments
hotnewtop
Profile icon
ch1ck3n

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

Profile icon
Kingq23

@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/client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "main.py", line 19, in on_message
cur_mon = int(db[message.author])
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/replit/database/database.py", line 432, in getitem
raw_val = self.get_raw(key)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/replit/database/database.py", line 470, in get_raw
r = self.sess.get(self.db_url + "/" + urllib.parse.quote(key))
File "/usr/lib/python3.8/urllib/parse.py", line 851, in quote
return quote_from_bytes(string, safe)
File "/usr/lib/python3.8/urllib/parse.py", line 876, in quote_from_bytes
raise TypeError("quote_from_bytes() expected bytes")
TypeError: quote_from_bytes() expected bytes

Profile icon
ch1ck3n

@qadams2008
ya first gotta make your repl public

Profile icon
Kingq23

@ch1ck3n
I made it public

Profile icon
Kingq23

@ch1ck3n
hello?