Skip to content

Giving an error saying "snapshot must be specified" when calling the firebase.get() function. #112

Description

@ModernShrub

Hello,
I am getting this error when pressing the "send" button in the following code:

from tkinter import *
from firebase import firebase
from simplecrypt import encrypt, decrypt
login_window = Tk()
login_window.geometry("400x400")
login_window.config(bg='#AB92BF')
fbase = firebase.FirebaseApplication("https://chattap-335d8-default-rtdb.firebaseio.com/", None)
print("firebase done")
login_window = Tk()
login_window.geometry("400x400")
login_window.config(bg='#AB92BF')
username = ''
your_code = ''
your_friends_code = ''
message_text = ''
message_entry = ''
last_value = ''
def getData():
global message_text global last_value
global your_code
global your_friends_code
get_your_data = firebase.get('/', your_code)
print(get_your_data)
byte_str = bytes.fromhex(get_your_data)
original = decrypt('AIM', byte_str)
print(original)
final_message = original.decode("utf-8")
print(final_message)
message_text.insert(END, final_message+"\n")
get_friends_data = firebase.get('/', your_friends_code)
if (get_friends_data() != None):
print(get_friends_data)
byte_str = bytes.fromhex(get_friends_data)
original = decrypt('AIM', byte_str)
print(original)
final_message = original.decode("utf-8")
if (final_message != NONE):
print(final_message)
message_text.insert(END, final_message+"\n")
last_value = final_message
def sendData(): global username
global message_entry
global your_code
message = username+ " : " + message_entry.get()
ciphercode = encrypt('AIM', message)
hex_string = ciphercode.hex()
put_date = fbase.put("/", your_code, hex_string)
print(put_date)
getData()
def enterRoom():
global message_entry
message_window = Tk()
message_window.config(bg='#AFC1D6')
message_window.geometry("600x500")
message_text = Text(message_window, height=20, width=72)
message_text.place(relx=0.5,rely=0.35, anchor=CENTER)
message_label = Label(message_window, text="Message " , font = 'arial 13', bg='#AFC1D6', fg="white")
message_label.place(relx=0.3,rely=0.8, anchor=CENTER)
message_entry = Entry(message_window, font = 'arial 15')
message_entry.place(relx=0.6,rely=0.8, anchor=CENTER)
btn_send = Button(message_window, text="Send", font = 'arial 13', bg="#D6CA98", fg="black", padx=10, relief=FLAT, command=sendData)
btn_send.place(relx=0.5,rely=0.9, anchor=CENTER)
message_window.mainloop()
login_window.destroy()
username_label = Label(login_window, text="Username : " , font = 'arial 13', bg ='#AB92BF', fg="white")
username_label.place(relx=0.3,rely=0.3, anchor=CENTER)
username_entry = Entry(login_window)
username_entry.place(relx=0.6,rely=0.3, anchor=CENTER)
your_code_label = Label(login_window, text="Your code : " , font = 'arial 13', bg ='#AB92BF', fg="white")
your_code_label.place(relx=0.3,rely=0.4, anchor=CENTER)
your_code_entry = Entry(login_window)
your_code_entry.place(relx=0.6,rely=0.4, anchor=CENTER)
friends_code_label = Label(login_window, text="Your Friends code : " , font = 'arial 13', bg ='#AB92BF', fg="white")
friends_code_label.place(relx=0.22,rely=0.5, anchor=CENTER)
friends_code_entry = Entry(login_window)
friends_code_entry.place(relx=0.6,rely=0.5, anchor=CENTER)
btn_start = Button(login_window, text="Start" , font = 'arial 13' , bg="#CEF9F2", fg="black", command=enterRoom, relief=FLAT, padx=10)
btn_start.place(relx=0.5,rely=0.65, anchor=CENTER)
login_window.mainloop()
```
"here is the error
```
Output from spyder call 'get_namespace_view':
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2800.0_x64__qbz5n2kfra8p0\lib\tkinter\__init__.py", line 1892, in __call__
return self.func(*args)
File "path to python file", line 58, in sendData
fbase.put("/", your_code, hex_string)
File "AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\firebase\decorators.py", line 20, in wrapped
return f(*args, **kwargs)
File \AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\firebase\firebase.py", line 295, in put
assert name, 'Snapshot name must be specified'
AssertionError: Snapshot name must be specified`
```
using spyder 5.2.2 running python 3.9
Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions