简体   繁体   中英

why am i getting "AttributeError: 'NoneType' object has no attribute 'get' "

im getting the error for the 10th line of code where i call for the entries string value, any help is appreciated and thanks in advance for the help. here is the entire error in case it helps:

  File "c:\Users\(MY NAME)\OneDrive\Code\(MY NAME).py", line 38, in verify_license_key
    url = f"https://api.gumroad.com/v2/licenses/verify?product_permalink=ewaqb&license_key={user_license_key.get()}&increment_uses_count=true"
AttributeError: 'NoneType' object has no attribute 'get'
    def verify_license_key():
            verify_license_window.update()
            os.chdir("C:\ProgramData")
            with open("verify.txt", "r") as f:
                contents = f.read()
                verify_license_window.update()
                if contents != "CYAmS$#Rr6fM$AKR9FS@#tXMetqNkzL3HCDYry!j":
                    verify_license_window.update()
                    f.close()
                    url = f"https://api.gumroad.com/v2/licenses/verify?product_permalink=ewaqb&license_key={user_license_key.get()}&increment_uses_count=true"
                    params = {}
                    r = requests.post(url = url, params = params)
                    result = r.json()
                    usesAmount = int(result['uses'])
                    verify_license_window.update()
                    
                    if usesAmount == 1:
                        with open("verify.txt", "w") as f:
                            verify_license_window.update()
                            f.write("CYAmS$#Rr6fM$AKR9FS@#tXMetqNkzL3HCDYry!j")
                            f.close()
                            verify_license_window.update()
                            change_status_verify("Confirmed")
                            verify_license_window.after(1000)
                            verify_license_window.update()
                            change_status_verify("Closing in 1 Second")
                            verify_license_window.after(1000)
                            verify_license_window.update()
                            verify_license_window.destroy()
                
                elif contents == "CYAmS$#Rr6fM$AKR9FS@#tXMetqNkzL3HCDYry!j":
                    f.close()
                    verify_license_window.update()
                    change_status_verify("Program Already Verified")
                    verify_license_window.after(1000)
                    verify_license_window.update()
                    change_status_verify("Closing In 1 Second")
                    verify_license_window.after(1000)
                    verify_license_window.destroy()
                    
    
                
        verify_license_window = Tk()
        #settings
        verify_license_window.minsize(300,200)
        verify_license_window.maxsize(300,200)
        verify_license_window.title("Verify License Key")
    
        #button
        Button(verify_license_window, padx=12, pady=12, text="Confirm",
command=verify_license_key).place(x=112, y=100)
    
        #label
        Label(verify_license_window, width=17 ,text="Enter License Key Here:").place(x=25,y=25)
    
        #entry
        user_license_key = Entry(verify_license_window, width=40).place(x=20,y=50)
        
    
        verify_license_window.mainloop()

This error is occurring at user_license_key.get() . user_license_key is the None here. Please try to print out it and check the value or type of it. If user_license_key is none, then you have to provide the appropriate value in this field.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM