# Make sure fd returned by fileno is valid.
open_url = self.urlopen("http://www.python.org/", timeout=None)
fd = open_url.fileno()
- FILE = os.fdopen(fd, encoding='utf-8')
+ FILE = os.fdopen(fd, 'rb')
try:
self.assertTrue(FILE.read(), "reading from file created using fd "
"returned by fileno failed")
file_location,info = self.urlretrieve("http://www.python.org/")
self.assertTrue(os.path.exists(file_location), "file location returned by"
" urlretrieve is not a valid path")
- FILE = open(file_location, encoding='utf-8')
+ FILE = open(file_location, 'rb')
try:
self.assertTrue(FILE.read(), "reading from the file location returned"
" by urlretrieve failed")
support.TESTFN)
self.assertEqual(file_location, support.TESTFN)
self.assertTrue(os.path.exists(file_location))
- FILE = open(file_location, encoding='utf-8')
+ FILE = open(file_location, 'rb')
try:
self.assertTrue(FILE.read(), "reading from temporary file failed")
finally: