Commit 321b0bf8 authored by Julien Muchembled's avatar Julien Muchembled

Update neo/ example

parent e5c056b9
......@@ -12,12 +12,15 @@ The prompt is accessible through network in case that the process is daemonized:
IF = 'pdb'
if IF == 'pdb':
import socket, sys, threading
from neo.lib.debug import getPdb
#from pdb import Pdb as getPdb
# Unfortunately, IPython does not always print to given stdout.
#from neo.lib.debug import getPdb
from pdb import Pdb as getPdb
class Socket(object):
def __init__(self, socket):
# In case that the default timeout is not None.
self._socket = socket
self._buf = ''
......@@ -55,9 +58,12 @@ if IF == 'pdb':
def pdb(app_set):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# For better security, maybe we should use a unix socket.
s.bind(('', 0))
print 'Listening to %u' % s.getsockname()[1]
sys.stdout.flush() # BBB: On Python 3, print() takes a 'flush' arg.
_socket = Socket(s.accept()[0])
......@@ -69,7 +75,7 @@ if IF == 'pdb':
app # this is Application instance (see 'app_set' if there are several)
app_set = sys.modules[''].app_set
app_set = sys.modules['neo.lib.threaded_app'].app_set
except KeyError:
f = sys._getframe(3)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment