pyTony
pyMod
6,310 posts since Apr 2010
Reputation Points: 879
Solved Threads: 987
Skill Endorsements: 26
Here the solution to this error was removing "0.0.0.0 localhost " from my hosts file located in "C:\Windows\System32\drivers\etc"
pyTony
pyMod
6,310 posts since Apr 2010
Reputation Points: 879
Solved Threads: 987
Skill Endorsements: 26
pyTony
pyMod
6,310 posts since Apr 2010
Reputation Points: 879
Solved Threads: 987
Skill Endorsements: 26
Maybe you need FTP_TLS, or need to have acct not ''?
FTP.set_debuglevel(level) could help to spot problem cause.
Actually I get same error when trying the HELP example:
>>> from ftplib import FTP
>>> ftp = FTP('ftp.cwi.nl')
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
ftp = FTP('ftp.cwi.nl')
File "I:\python27\lib\ftplib.py", line 117, in __init__
self.connect(host)
File "I:\python27\lib\ftplib.py", line 132, in connect
self.sock = socket.create_connection((self.host, self.port), self.timeout)
File "I:\python27\lib\socket.py", line 553, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
gaierror: [Errno 11001] getaddrinfo failed
>>>
But this address does not exist anymore, this works:
>>> ftp = FTP('ftp.uwasa.fi')
>>> ftp.login()
"230-> Welcoming to Garbo archives.\n230->\n230-> Type 'ls -CF' or 'ls -lF' or 'ls -lF |more' for the directory contents.\n230-> Type 'cd /pc' to go to the main MsDos directory. May differ on mirrors.\n230-> ^^^^^^\n230-> No support. All the moderators have other, principal occupations.\n230-> For any questions please see http://lipas.uwasa.fi/~ts/garbo.html#faq\n230->\n230-> +-----------------------------------------------------------+\n230-> ! If you have files to submit please do *NOT* upload before !\n230-> ! carefully reading the /pc/UPLOAD.TXT instructions !\n230-> ! Uploads without _*EMAILED*_ announcements are rejected. !\n230-> ! First see http://www.uwasa.fi/~ts/garbinfo/garb1996.html !\n230-> +-----------------------------------------------------------+\n230->\n230-> Your actions at Garbo are logged. If this bothers you, type 'quit' now.\n230 Login successful."
>>> ftp.retrlines('LIST')
drwxr-xr-x 63 ftp ftp 4096 Dec 22 10:50 cs
drwxr-xr-x 2 ftp ftp 4096 Mar 23 2004 garbo-gifs
drwx------ 2 ftp ftp 16384 Jan 21 2000 lost+found
-rw-r--r-- 1 ftp ftp 14116208 Apr 01 20:55 ls-lR
lrwxrwxrwx 1 ftp ftp 8 Mar 30 2006 mirror -> mirrors/
drwxr-xr-x 3 ftp ftp 4096 Aug 12 2008 mirrors
drwxr-xr-x 130 ftp ftp 4096 Apr 01 20:55 pc
drwxrwxr-x 2 ftp ftp 4096 Apr 12 2009 private-ts
lrwxrwxrwx 1 ftp ftp 1 Mar 30 2006 pub -> .
drwxr-xr-x 7 ftp ftp 4096 Feb 13 2005 ql
drwxr-xr-x 11 ftp ftp 4096 Mar 23 2004 software
drwxr-xr-x 56 ftp ftp 4096 Apr 01 20:55 unix
drwxr-xr-x 5 ftp ftp 4096 Oct 16 2002 win32
drwxr-xr-x 66 ftp ftp 4096 Apr 01 20:55 win95
drwxr-xr-x 36 ftp ftp 4096 Apr 01 20:55 windows
'226 Directory send OK.'
>>>
pyTony
pyMod
6,310 posts since Apr 2010
Reputation Points: 879
Solved Threads: 987
Skill Endorsements: 26
Simple
ftp.sendcmd("quote site reboot")
or without quote
ftp.sendcmd("site reboot")
did not work?
pyTony
pyMod
6,310 posts since Apr 2010
Reputation Points: 879
Solved Threads: 987
Skill Endorsements: 26
How about
ftplib.sendcmd('"quote" site reboot')
or
ftplib.sendcmd('"quote" "site reboot"')
pyTony
pyMod
6,310 posts since Apr 2010
Reputation Points: 879
Solved Threads: 987
Skill Endorsements: 26
You did not try what I said yet, I had " inside '
pyTony
pyMod
6,310 posts since Apr 2010
Reputation Points: 879
Solved Threads: 987
Skill Endorsements: 26
line 3 and 4 seems to do nothing in your first code (method name without call and unused variable).
pyTony
pyMod
6,310 posts since Apr 2010
Reputation Points: 879
Solved Threads: 987
Skill Endorsements: 26