怎么解决python在连接ftp时报错:EOFError
【代码】:#!/usr/lcoal/envpython#-*-coding=utf-8-*-fromftplibimportFTPftp=FTP()ftp.set_deb...
【代码】:
#!/usr/lcoal/env python
#-*- coding=utf-8 -*-
from ftplib import FTP
ftp=FTP()
ftp.set_debuglevel(2)
ftp.connect("172.20.10.203","22")
ftplogin("root","111111")
print ftp.getwelcome("connect success")
【报错】:
[root@198 python]# python test1.py
*get* 'SSH-2.0-OpenSSH_5.3\r\n'
*get* ''
Traceback (most recent call last):
File "test1.py", line 6, in <module>
ftp.connect("172.20.10.198","22")
File "/usr/lib64/python2.6/ftplib.py", line 134, in connect
self.welcome = self.getresp()
File "/usr/lib64/python2.6/ftplib.py", line 209, in getresp
resp = self.getmultiline()
File "/usr/lib64/python2.6/ftplib.py", line 199, in getmultiline
nextline = self.getline()
File "/usr/lib64/python2.6/ftplib.py", line 185, in getline
if not line: raise EOFError
EOFError 展开
#!/usr/lcoal/env python
#-*- coding=utf-8 -*-
from ftplib import FTP
ftp=FTP()
ftp.set_debuglevel(2)
ftp.connect("172.20.10.203","22")
ftplogin("root","111111")
print ftp.getwelcome("connect success")
【报错】:
[root@198 python]# python test1.py
*get* 'SSH-2.0-OpenSSH_5.3\r\n'
*get* ''
Traceback (most recent call last):
File "test1.py", line 6, in <module>
ftp.connect("172.20.10.198","22")
File "/usr/lib64/python2.6/ftplib.py", line 134, in connect
self.welcome = self.getresp()
File "/usr/lib64/python2.6/ftplib.py", line 209, in getresp
resp = self.getmultiline()
File "/usr/lib64/python2.6/ftplib.py", line 199, in getmultiline
nextline = self.getline()
File "/usr/lib64/python2.6/ftplib.py", line 185, in getline
if not line: raise EOFError
EOFError 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询