Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 24611f8

Browse files
committed
Always open file objects in binary mode.
1 parent 336c699 commit 24611f8

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Lib/ftplib.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def connect(self, host = '', port = 0):
111111
self.passiveserver = 0
112112
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
113113
self.sock.connect(self.host, self.port)
114-
self.file = self.sock.makefile('r')
114+
self.file = self.sock.makefile('rb')
115115
self.welcome = self.getresp()
116116

117117
def getwelcome(self):
@@ -323,7 +323,7 @@ def retrlines(self, cmd, callback = None):
323323
if not callback: callback = print_line
324324
resp = self.sendcmd('TYPE A')
325325
conn = self.transfercmd(cmd)
326-
fp = conn.makefile('r')
326+
fp = conn.makefile('rb')
327327
while 1:
328328
line = fp.readline()
329329
if self.debugging > 2: print '*retr*', `line`

0 commit comments

Comments
 (0)