Unhelpful error message

Stephen Tucker stephen_tucker at sil.org
Tue Jun 6 13:09:13 EDT 2017


Hi,

I have just been thrown through an unecessary loop because of an unhelpful
error message.

I am running Python 2.7.10 on a Windows 10 machine.

I incorporate sample output from IDLE:

~~~~~~~~~~~~~~~~~~~~~~~~~~~

>>> print float ("123.456")
123.456
>>> print float ("")

Traceback (most recent call last):
  File "<pyshell#60>", line 1, in <module>
    print float ("")
ValueError: could not convert string to float:
>>>

~~~~~~~~~~~~~~~~~~~~~~~~~~~
The unhelpful message is the response that the system gives when you try to
convert a null string to a floating point number. Now, in the example I
have given here, it is obvious that the string is null, but in the example
that threw me into a loop, it was not obvious.

It would be more helpful is the system replied:

ValueError: could not convert null string to float

Any chance of that becoming the case?

Stephen Tucker.


<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>



More information about the Python-list mailing list