Issues with Eventlet 0.21 and ftplib in Python3

Hi,

There is an issue with Eventlet 0.21 and ftplib in Python 3. The issue is
fixed in Eventlet 0.22.

Specifically, the issue with with contextmanager support in `socket` as
used by `storbinary`.

Nameko is pinned to 0.21 for now. Does anyone have any suggestions for me?
It kinda breaks a big part of my solution.

I know what I need to do... I just don't know how to do it (yet).

I need to patch GreenSocket with this:

    def __enter__(self):
        return self

    def __exit__(self, *args):
        self.close()
···

On Tuesday, February 20, 2018 at 11:28:21 AM UTC-8, juko...@gmail.com wrote:

Hi,

There is an issue with Eventlet 0.21 and ftplib in Python 3. The issue is
fixed in Eventlet 0.22.

Specifically, the issue with with contextmanager support in `socket` as
used by `storbinary`.

Nameko is pinned to 0.21 for now. Does anyone have any suggestions for me?
It kinda breaks a big part of my solution.

socket.create_connection cannot be used as a context manager · Issue #430 · eventlet/eventlet · GitHub

Eventlet 0.22 is quite incompatible with Nameko unfortunately. The issue is
here: eventlet.wsgi.Server.process_request invocation changed · Issue #420 · eventlet/eventlet · GitHub

I've not figured out how to fix it yet though.

In the mean time I think this is the patch you need:

from eventlet.greenio.base import GreenSocket

def __enter__(self):
    return self

def __exit__(self, *args):
    self.close()

GreenSocket.__enter__ = __enter__
GreenSocket.__exit__ = __exit__

Just make this runs before you need to use an GreenSocket objects as a
context manager.

···

On Tuesday, February 20, 2018 at 7:59:25 PM UTC, juko...@gmail.com wrote:

I know what I need to do... I just don't know how to do it (yet).

I need to patch GreenSocket with this:

    def __enter__(self):
        return self

    def __exit__(self, *args):
        self.close()

On Tuesday, February 20, 2018 at 11:28:21 AM UTC-8, juko...@gmail.com > wrote:

Hi,

There is an issue with Eventlet 0.21 and ftplib in Python 3. The issue is
fixed in Eventlet 0.22.

Specifically, the issue with with contextmanager support in `socket` as
used by `storbinary`.

Nameko is pinned to 0.21 for now. Does anyone have any suggestions for
me? It kinda breaks a big part of my solution.

socket.create_connection cannot be used as a context manager · Issue #430 · eventlet/eventlet · GitHub

Thanks Matt!

I worked out the same solution myself.

No worries on the 0.22 - this is the only issue I've had to far (I'm using
PyFilesystem2 to do FTP deliveries).

Thanks for the quick response, and Nameko in general :slight_smile:

···

On Tuesday, February 20, 2018 at 12:15:10 PM UTC-8, Matt Yule-Bennett wrote:

Eventlet 0.22 is quite incompatible with Nameko unfortunately. The issue
is here: eventlet.wsgi.Server.process_request invocation changed · Issue #420 · eventlet/eventlet · GitHub

I've not figured out how to fix it yet though.

In the mean time I think this is the patch you need:

from eventlet.greenio.base import GreenSocket

def __enter__(self):
    return self

def __exit__(self, *args):
    self.close()

GreenSocket.__enter__ = __enter__
GreenSocket.__exit__ = __exit__

Just make this runs before you need to use an GreenSocket objects as a
context manager.

On Tuesday, February 20, 2018 at 7:59:25 PM UTC, juko...@gmail.com wrote:

I know what I need to do... I just don't know how to do it (yet).

I need to patch GreenSocket with this:

    def __enter__(self):
        return self

    def __exit__(self, *args):
        self.close()

On Tuesday, February 20, 2018 at 11:28:21 AM UTC-8, juko...@gmail.com >> wrote:

Hi,

There is an issue with Eventlet 0.21 and ftplib in Python 3. The issue
is fixed in Eventlet 0.22.

Specifically, the issue with with contextmanager support in `socket` as
used by `storbinary`.

Nameko is pinned to 0.21 for now. Does anyone have any suggestions for
me? It kinda breaks a big part of my solution.

socket.create_connection cannot be used as a context manager · Issue #430 · eventlet/eventlet · GitHub