Python Forum
Handling null or empty entries from Entry Widget - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Handling null or empty entries from Entry Widget (/thread-16847.html)



Handling null or empty entries from Entry Widget - KevinBrown - Mar-17-2019

I am taking values from Entry widgets, some of which can be a null /empty and to run them into SQLite.


Suct = float(EntSuct.get())[/quote]
How should I handle this to avoid these kinds of errors?


Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\tkinter\__init__.py", line 1705, in __call__
    return self.func(*args)
  File "C:\MyScripts\Pump_Calc.py", line 124, in FileSave
    Suct = float(EntSuct.get())
ValueError: could not convert string to float: 
By the way.
What's the Unladen Swallow title below my name and avatar?


RE: Handling null or empty entries from Entry Widget - perfringo - Mar-17-2019

I am no admin on this site, but for context you can read this: swallow

In Python there is try...except for handling errors.