[issue12576] urlib.request fails to open some sites

2011-07-22 Thread angus

angus  added the comment:

I'm experiencing a related problem:
---
from urllib.request import urlopen
print(urlopen('https://mtgox.com/').read())
---
prints b'' rather than the page content.

It looks like mtgox.com always sends 'Connection: Keep-Alive'. So some hack 
like recognising 'tion: close' wouldn't fix it.

--
nosy: +angus

___
Python tracker 
<http://bugs.python.org/issue12576>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44124] Unhelpful SyntaxError message with mis-ordering of f-string specifiers

2021-05-13 Thread Angus L'Herrou


New submission from Angus L'Herrou :

The f-string grammar clearly specifies the correct order of f-string =, !, and 
: specifiers:

replacement_field ::=  "{" f_expression ["="] ["!" conversion] [":" 
format_spec] "}"

However, when these components are used in the wrong order, the error messages, 
while understandable if you know the grammar, are not exactly helpful for users 
of all knowledge levels.


>>> foo = 12.345
>>> f'{foo=:.2f}'  # correct ordering of = and :
'foo=12.35'
>>> f'{foo:.2f=}'  # incorrect ordering of : and =
Traceback (most recent call last):
  File "", line 1, in 
ValueError: Invalid format specifier
>>> f'{foo=!r}'# correct ordering of = and !
'foo=12.345'
>>> f'{foo!r=}'# incorrect ordering of ! and =
  File "", line 1
SyntaxError: f-string: expecting '}'
>>> bar = 'abcd'
>>> f'{bar!r:.2s}' # correct ordering of ! and :
"'a"
>>> f'{bar:.2s!r}' # incorrect ordering of : and !
Traceback (most recent call last):
  File "", line 1, in 
ValueError: Invalid format specifier


It would be more helpful to have more descriptive error messages specifying the 
correct order of these features. f-string format specifiers, especially ! and 
=, are in my experience fairly poorly known features, and more descriptive 
feedback when they are used incorrectly would avoid discouraging users from 
using them at all upon encountering a cryptic error. 

Since __format__ can have an arbitrary implementation for different data types, 
and therefore there might be some user-defined class that accepts :.2f!r as a 
valid format specifier, the ValueErrors here might have to stay, but at least 
the SyntaxError from f'{foo!r=}' could be clearer.

--
components: Parser
messages: 393587
nosy: angus-lherrou, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: Unhelpful SyntaxError message with mis-ordering of f-string specifiers
type: enhancement
versions: Python 3.10, Python 3.11, Python 3.8, Python 3.9

___
Python tracker 
<https://bugs.python.org/issue44124>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44124] Unhelpful error messages with mis-ordering of f-string specifiers

2021-05-13 Thread Angus L'Herrou


Change by Angus L'Herrou :


--
title: Unhelpful SyntaxError message with mis-ordering of f-string specifiers 
-> Unhelpful error messages with mis-ordering of f-string specifiers

___
Python tracker 
<https://bugs.python.org/issue44124>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29969] Typo in decimal error message

2017-04-03 Thread Angus Hollands

New submission from Angus Hollands:

When passing an object that fails Py_FloatCheck, the error message raised reads
"argument must be int of float", rather than "argument must be int or float"

--
components: Extension Modules
messages: 291070
nosy: Angus Hollands
priority: normal
severity: normal
status: open
title: Typo in decimal error message
type: enhancement
versions: Python 3.7

___
Python tracker 
<http://bugs.python.org/issue29969>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29969] Typo in decimal error message

2017-04-03 Thread Angus Hollands

Changes by Angus Hollands :


--
pull_requests: +1151

___
Python tracker 
<http://bugs.python.org/issue29969>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21818] cookielib documentation references Cookie module, not cookielib.Cookie class

2014-06-20 Thread Angus Taggart

New submission from Angus Taggart:

all the links to Cookie class in the cookielib documentation point to Cookie 
module.


for example:

CookieJar.set_cookie(cookie)

Set a *Cookie*, without checking with policy to see whether or not it 
should be set.


cookie in the documentation links to
https://docs.python.org/2/library/cookie.html#module-Cookie

cookie in the documentation should link to
https://docs.python.org/2/library/cookielib.html#cookielib.Cookie

--
assignee: docs@python
components: Documentation
messages: 221133
nosy: Ajtag, docs@python
priority: normal
severity: normal
status: open
title: cookielib documentation references Cookie module, not cookielib.Cookie 
class
versions: Python 2.7

___
Python tracker 
<http://bugs.python.org/issue21818>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com