This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2009年03月31日 17:08 by jhylton, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Messages (10) | |||
|---|---|---|---|
| msg84840 - (view) | Author: Jeremy Hylton (jhylton) (Python triager) | Date: 2009年03月31日 17:08 | |
import io
import urllib.request
f_bytes = urllib.request.urlopen("http://www.python.org/")
f_string = io.TextIOWrapper(f_bytes, "iso-8859-1")
print(f_string.read())
|
|||
| msg84945 - (view) | Author: Benjamin Peterson (benjamin.peterson) * (Python committer) | Date: 2009年03月31日 23:11 | |
Fixed in r70928. |
|||
| msg84951 - (view) | Author: Senthil Kumaran (orsenthil) * (Python committer) | Date: 2009年04月01日 00:04 | |
Nope, this is not yet fixed.
$ ./python
Python 3.1a1+ (py3k:70929, Mar 31 2009, 19:18:12)
[GCC 4.3.2] on linux2
...
...
>>> f_bytes = urllib.request.urlopen("http://www.python.org")
>>> f_string = io.TextIOWrapper(f_bytes,"iso-8859-1")
>>> print(f_string.read())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IOError: not readable
|
|||
| msg84953 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2009年04月01日 00:36 | |
urllib.response.addinfourl doesn't seem to implement the required ABC
(BufferedIOBase) properly. It misses the read1() method. Also, it claims
not to be readable:
>>> f_bytes = urllib.request.urlopen("http://www.python.org/")
>>> f_bytes.readable()
False
|
|||
| msg84961 - (view) | Author: Jeremy Hylton (jhylton) (Python triager) | Date: 2009年04月01日 02:26 | |
I just wanted to mention that the current head of py3k returns an http.client.HTTPResponse and not a urllib.respone.addinfourl. That doesn't mean it is the right thing to pass to TextIOWrapper. It's an instance of RawIOBase. |
|||
| msg84963 - (view) | Author: Senthil Kumaran (orsenthil) * (Python committer) | Date: 2009年04月01日 02:34 | |
Jeremy Hylton wrote: > That doesn't mean it is the right thing to pass to TextIOWrapper. It's an > instance of RawIOBase. I guess, you meant " That doesn't mean it is *not* the right thing to pass to TextIOWrapper". |
|||
| msg84968 - (view) | Author: Senthil Kumaran (orsenthil) * (Python committer) | Date: 2009年04月01日 03:04 | |
With the changes r70935, this works. |
|||
| msg84970 - (view) | Author: Benjamin Peterson (benjamin.peterson) * (Python committer) | Date: 2009年04月01日 03:17 | |
Please note that passing a instance of RawIOBase (as HTTPResponse) is to TextIOWrapper is *not* supported. You must first wrap the raw IO in a BufferIOBase instance. |
|||
| msg87764 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2009年05月14日 21:12 | |
I suppose it is fixed, isn't it? |
|||
| msg87765 - (view) | Author: Benjamin Peterson (benjamin.peterson) * (Python committer) | Date: 2009年05月14日 21:15 | |
Yes |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:56:47 | admin | set | github: 49878 |
| 2009年05月14日 21:15:12 | benjamin.peterson | set | status: pending -> closed resolution: fixed messages: + msg87765 |
| 2009年05月14日 21:12:27 | pitrou | set | status: open -> pending messages: + msg87764 |
| 2009年04月01日 03:17:05 | benjamin.peterson | set | messages: + msg84970 |
| 2009年04月01日 03:04:29 | orsenthil | set | messages: + msg84968 |
| 2009年04月01日 02:34:31 | orsenthil | set | messages: + msg84963 |
| 2009年04月01日 02:26:47 | jhylton | set | messages: + msg84961 |
| 2009年04月01日 00:38:17 | pitrou | set | priority: high type: behavior resolution: accepted -> (no value) versions: + Python 3.1 |
| 2009年04月01日 00:36:06 | pitrou | set | nosy:
+ pitrou messages: + msg84953 |
| 2009年04月01日 00:04:28 | orsenthil | set | status: closed -> open nosy: + orsenthil messages: + msg84951 resolution: fixed -> accepted |
| 2009年03月31日 23:11:55 | benjamin.peterson | set | status: open -> closed nosy: + benjamin.peterson messages: + msg84945 resolution: fixed |
| 2009年03月31日 17:08:43 | jhylton | create | |