diff --git a/examples/nonblocking_execute.py b/examples/nonblocking_execute.py
index <HASH>..<HASH> 100755
--- a/examples/nonblocking_execute.py
+++ b/examples/nonblocking_execute.py
@@ -62,7 +62,7 @@ def main():
     # Now we can set non-blocking mode
     s.set_blocking(False)
     chan = s.open_session()
-    while chan is None:
+    while chan == LIBSSH2_ERROR_EAGAIN:
         print("Would block on session open, waiting for socket to be ready")
         wait_socket(sock, s)
         chan = s.open_session()
Fix for AttributeError in non-blocking example (#<I>)

* Correctly handle opening channel in non-blocking example