giampaolo / pyftpdlib

Extremely fast and scalable Python FTP server library
MIT License
1.67k stars 264 forks source link

Extending compatiblity with older asyncore/python versions #16

Closed giampaolo closed 10 years ago

giampaolo commented 10 years ago

From billiej...@gmail.com on July 10, 2007 03:35:34

By using Python versions prior to 2.4 pyftpdlib fails starting on systems
where poll() is not available.

<snippet>
Traceback (most recent call last):
   File "/ffs/lib/python2.3/site-packages/pyftpdlib/FTPServer.py", line
1206, in serve_forever
    asyncore.loop(timeout=1, use_poll=True)
  File "/tgtsvr/lib/python2.3/asyncore.py", line 193, in loop
  File "/tgtsvr/lib/python2.3/asyncore.py", line 128, in poll2
ImportError: No module named poll
</snippet>

This does not happen with newer asyncore versions (included with Python 2.4
and higher) which first check if poll() is available or not, in which case
select() is silently used.
Instead of telling asyncore to use poll by default we should first check if
poll is available or not by simply using the following statement:

>>> asyncore.loop(timeout=1, use_poll=hasattr(asyncore.select, 'poll'))

This should grant backward compatibility with older asyncore versions
included with Python 2.2, 2.3 and 2.4.

Thanks to Greg Copeland (GCopeland AT efjohnson DOT com) for having
submitted such report.

Original issue: http://code.google.com/p/pyftpdlib/issues/detail?id=16

giampaolo commented 10 years ago

From billiej...@gmail.com on July 17, 2007 08:35:24

Owner: billiejoex
Cc: -aleaxit jloden yanraber

giampaolo commented 10 years ago

From billiej...@gmail.com on July 19, 2007 19:20:38

Fixed in SVN, revision #13

Status: Finished

giampaolo commented 10 years ago

From jlo...@gmail.com on July 24, 2007 00:59:27

Setting this value to True breaks OS X systems due to the differing 
implementation of
select.poll() versus asyncore.poll()

However, setting it to False does not appear to break any test systems on any OS or
version of Python. I would recommend in that light that rather than 
implementing this
fix, we actually just set use_poll to False to allow asyncore to use it's own
internal implementation of poll()
giampaolo commented 10 years ago

From jlo...@gmail.com on July 24, 2007 08:02:49

Fixed in SVN, set use_poll to False for compatibility with older Python 
versions and
to avoid OS X bug ( Issue #26 )
giampaolo commented 10 years ago

From jlo...@gmail.com on July 24, 2007 08:04:12

Fixed in Revision 47
giampaolo commented 10 years ago

From jlo...@gmail.com on July 24, 2007 08:10:10

Status: Obsoleted

giampaolo commented 10 years ago

From billiej...@gmail.com on October 25, 2007 06:50:22

Labels: -Usability Compatibility

giampaolo commented 10 years ago

From billiej...@gmail.com on May 02, 2008 11:31:13

Labels: Version-0.1.1 Milestone-0.2.0

giampaolo commented 10 years ago

From billiej...@gmail.com on October 13, 2008 12:13:13

Labels: Component-Library

giampaolo commented 10 years ago

From g.rodola on August 11, 2010 15:17:12

Owner: ---
Labels: Python-2.3