2016-10-04 1 views
2

Ceci est mon erreur:"IOError: [Errno erreur ftp] 200 Type défini sur I" lors de l'installation de la source lxml

C:\WINDOWS\system32>pip install scrapy --upgrade 

Requirement already up-to-date: scrapy in c:\python27\lib\site-packages\scrapy-1.2.0-py2.7.egg 
Requirement already up-to-date: Twisted>=10.0.0 in c:\python27\lib\site-packages (from scrapy) 
Requirement already up-to-date: w3lib>=1.15.0 in c:\python27\lib\site-packages (from scrapy) 
Requirement already up-to-date: queuelib in c:\python27\lib\site-packages (from scrapy) 

Collecting lxml (from scrapy) 

    Using cached lxml-3.6.4.tar.gz 

    Complete output from command python setup.py egg_info: 
    Building lxml version 3.6.4. 
    Retrieving "ftp://ftp.zlatkovic.com/pub/libxml/libxslt-1.1.26.win32.zip" to "libs\libxslt-1.1.26.win32.zip" 
    Traceback (most recent call last): 
     File "<string>", line 1, in <module> 
     File "c:\users\thezm\appdata\local\temp\pip-build-y3m3fl\lxml\setup.py", line 233, in <module> 
     **setup_extra_options() 
     File "c:\users\thezm\appdata\local\temp\pip-build-y3m3fl\lxml\setup.py", line 144, in setup_extra_options 
     STATIC_CFLAGS, STATIC_BINARIES) 
     File "setupinfo.py", line 55, in ext_modules 
     OPTION_DOWNLOAD_DIR, static_include_dirs, static_library_dirs) 
     File "buildlibxml.py", line 95, in get_prebuilt_libxml2xslt 
     libs = download_and_extract_zlatkovic_binaries(download_dir) 
     File "buildlibxml.py", line 55, in download_and_extract_zlatkovic_binaries 
     urlretrieve(srcfile, destfile) 
     File "c:\python27\lib\urllib.py", line 98, in urlretrieve 
     return opener.retrieve(url, filename, reporthook, data) 
     File "c:\python27\lib\urllib.py", line 245, in retrieve 
     fp = self.open(url, data) 
     File "c:\python27\lib\urllib.py", line 213, in open 
     return getattr(self, name)(url) 
     File "c:\python27\lib\urllib.py", line 558, in open_ftp 
     (fp, retrlen) = self.ftpcache[key].retrfile(file, type) 
     File "c:\python27\lib\urllib.py", line 906, in retrfile 
     conn, retrlen = self.ftp.ntransfercmd(cmd) 
     File "c:\python27\lib\ftplib.py", line 334, in ntransfercmd 
     host, port = self.makepasv() 
     File "c:\python27\lib\ftplib.py", line 312, in makepasv 
     host, port = parse227(self.sendcmd('PASV')) 
     File "c:\python27\lib\ftplib.py", line 830, in parse227 
     raise error_reply, resp 
    IOError: [Errno ftp error] 200 Type set to I 

    ---------------------------------------- 
Command "python setup.py egg_info" failed with error code 1 in c:\users\thezm\appdata\local\temp\pip-build-y3m3fl\lxml\ 

Comment puis-je résoudre ce problème?

+0

'[Errno erreur ftp] 200 Type réglé sur î' il semble qu'il ya un problème avec le serveur FTP. Peut-être essayer demain. Ou essayez de télécharger 'ftp: // ftp.zlatkovic.com/pub/libxml/libxslt-1.1.26.win32.zip' et installez manuellement. – furas

Répondre

3

Ceci est dû à a bug in ftplib and/or urllib: La réponse FTP 226 est ignorée, provoquant une correspondance incorrecte du client avec les commandes sortantes. J'ai fait quelques recherches et suis arrivé à la conclusion que urllib ne peut pas être entièrement corrigé avec ftplib comme c'est maintenant. Vous pouvez utiliser le correctif suivant pour urllib.py pour résoudre ce problème particulier si (la diff est pour Python 2.7.12):

--- a/urllib.py Sat Jun 25 22:46:20 2016 
+++ b/urllib.py Sat Dec 10 00:20:48 2016 
@@ -927,7 +927,7 @@ 
     self.busy = 1 
     ftpobj = addclosehook(conn.makefile('rb'), self.file_close) 
     self.refcount += 1 
-  conn.close() 
+  #conn.close() 
     # Pass back both a suitably decorated object and a retrieval length 
     return (ftpobj, retrlen) 

@@ -940,7 +940,14 @@ 
      self.real_close() 

    def file_close(self): 
+  import ftplib 
     self.endtransfer() 
+  #Process the 226 transfer complete response 
+  try: 
+   self.ftp.voidresp() 
+  except ftplib.error_temp as msg: 
+   # transfer is aborted by urllib when some other exception has happened 
+   if msg.args[0][:3] != '426': raise 
     self.refcount -= 1 
     if self.refcount <= 0 and not self.keepalive: 
      self.real_close() 
@@ -990,15 +997,13 @@ 
     self.hookargs = hookargs 

    def close(self): 
-  try: 
-   closehook = self.closehook 
-   hookargs = self.hookargs 
-   if closehook: 
-    self.closehook = None 
-    self.hookargs = None 
-    closehook(*hookargs) 
-  finally: 
-   addbase.close(self) 
+  addbase.close(self) 
+  closehook = self.closehook 
+  hookargs = self.hookargs 
+  if closehook: 
+   self.closehook = None 
+   self.hookargs = None 
+   closehook(*hookargs) 


class addinfo(addbase): 
+0

désolé mais cela n'a pas fonctionné pour moi, j'utilise plutôt urllib2. – Statham

+0

@Statham cela signifie que vous avez un problème différent de celui décrit dans cette question. Demandez-le comme un autre. –

+0

merci @ivan_pozdeev, cela a fonctionné pour moi :) Je n'ai pas inclus l'extrait pour 'def close (self):' –