Re: Unhelpful error message

2017-06-06 Thread Thomas Nyberg
On 06/06/2017 02:32 PM, Chris Angelico wrote: > > That's what I thought. If the OP's happy to upgrade to 3.6/3.7, of > course, the problem disappears. > > ChrisA > As far as I can tell this affects all versions of python. Here are some versions I played with: 2.7: >>> float("") Traceback (most

Re: Unhelpful error message

2017-06-06 Thread Chris Angelico
On Wed, Jun 7, 2017 at 7:28 AM, Terry Reedy wrote: >> Yeah. Unfortunately this exception doesn't make good use of its args, >> so you can't get programmatic information from it (this is true in 3.7 >> too actually). So if a change were to be made, I'd recommend putting >> the actual string into e.

Re: Unhelpful error message

2017-06-06 Thread Terry Reedy
On 6/6/2017 2:29 PM, Chris Angelico wrote: On Wed, Jun 7, 2017 at 4:22 AM, Skip Montanaro wrote: On Tue, Jun 6, 2017 at 12:27 PM, Chris Angelico wrote: Or perhaps showing the repr of the string would be clearer. This would definitely be better, I think, and require no special casing of the

Re: Unhelpful error message

2017-06-06 Thread Chris Angelico
On Wed, Jun 7, 2017 at 4:31 AM, Thomas Nyberg wrote: > Does it make sense to open a bug report? I'm always a bit intimidated by > contributing to python, but the following patch does seem to work > (against a new clone of the master branch): Your original post talked about 2.7; when you say "mast

Re: Unhelpful error message

2017-06-06 Thread Jon Ribbens
On 2017-06-06, Thomas Nyberg wrote: > On 06/06/2017 11:46 AM, Jon Ribbens wrote: >> On 2017-06-06, Thomas Nyberg wrote: >>> My changes feel a bit hacky. I wanted to just drop a straight repr() in, >>> but I didn't want to change the code too much since I assume the string >>> formatting is alread

Re: Unhelpful error message

2017-06-06 Thread Thomas Nyberg
On 06/06/2017 11:38 AM, Jon Ribbens wrote: > On 2017-06-06, Peter Otten <__pete...@web.de> wrote: >> ...but not the empty string: >> > float("") >> Traceback (most recent call last): >> File "", line 1, in >> ValueError: could not convert string to float: >> >> Maybe there were some backwar

Re: Unhelpful error message

2017-06-06 Thread Thomas Nyberg
On 06/06/2017 11:46 AM, Jon Ribbens wrote: > On 2017-06-06, Thomas Nyberg wrote: >> My changes feel a bit hacky. I wanted to just drop a straight repr() in, >> but I didn't want to change the code too much since I assume the string >> formatting is already there for a reason (e.g. "%.200s"). > >

Re: Unhelpful error message

2017-06-06 Thread Jon Ribbens
On 2017-06-06, Thomas Nyberg wrote: > My changes feel a bit hacky. I wanted to just drop a straight repr() in, > but I didn't want to change the code too much since I assume the string > formatting is already there for a reason (e.g. "%.200s"). Just change the '%.200s' to '%.200R' and it should w

Re: Unhelpful error message

2017-06-06 Thread Jon Ribbens
On 2017-06-06, Peter Otten <__pete...@web.de> wrote: > ...but not the empty string: > float("") > Traceback (most recent call last): > File "", line 1, in > ValueError: could not convert string to float: > > Maybe there were some backward compatibility concerns that I lack the > fantasy t

Re: Unhelpful error message

2017-06-06 Thread Thomas Nyberg
On 06/06/2017 11:22 AM, Skip Montanaro wrote: > On Tue, Jun 6, 2017 at 12:27 PM, Chris Angelico wrote: >> Or perhaps showing the repr of the string would be clearer. > > This would definitely be better, I think, and require no special > casing of the empty string. Still, I doubt this would ever b

Re: Unhelpful error message

2017-06-06 Thread Chris Angelico
On Wed, Jun 7, 2017 at 4:22 AM, Skip Montanaro wrote: > On Tue, Jun 6, 2017 at 12:27 PM, Chris Angelico wrote: >> Or perhaps showing the repr of the string would be clearer. > > This would definitely be better, I think, and require no special > casing of the empty string. Still, I doubt this woul

Re: Unhelpful error message

2017-06-06 Thread Skip Montanaro
On Tue, Jun 6, 2017 at 12:27 PM, Chris Angelico wrote: > Or perhaps showing the repr of the string would be clearer. This would definitely be better, I think, and require no special casing of the empty string. Still, I doubt this would ever be backported for fear of breaking code might be out the

Re: Unhelpful error message

2017-06-06 Thread Peter Otten
Stephen Tucker wrote: > 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: > > ~~~

Re: Unhelpful error message

2017-06-06 Thread Chris Angelico
On Wed, Jun 7, 2017 at 3:09 AM, Stephen Tucker wrote: > 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. > >>>> print float ("") > > Traceback (most

Unhelpful error message

2017-06-06 Thread Stephen Tucker
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