Python Forum

Full Version: Handling null or empty entries from Entry Widget
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?
I am no admin on this site, but for context you can read this: swallow

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