Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vincent Pelletier
neoppod
Commits
9e026d08
Commit
9e026d08
authored
Jul 03, 2015
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix neo/debug.py example for clients
parent
e03a836a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
14 deletions
+24
-14
neo/debug.py
neo/debug.py
+21
-11
neo/lib/debug.py
neo/lib/debug.py
+3
-3
No files found.
neo/debug.py
View file @
9e026d08
...
...
@@ -11,8 +11,8 @@ The prompt is accessible through network in case that the process is daemonized:
if
1
:
import
socket
,
sys
,
threading
#
from neo.lib.debug import getPdb
from
pdb
import
Pdb
as
getPdb
from
neo.lib.debug
import
getPdb
#
from pdb import Pdb as getPdb
class
Socket
(
object
):
...
...
@@ -51,7 +51,7 @@ if 1:
self
.
_socket
.
setblocking
(
1
)
return
False
def
pdb
(
app
):
def
pdb
(
app
_set
):
s
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
try
:
s
.
bind
((
'127.0.0.1'
,
0
))
...
...
@@ -60,14 +60,24 @@ if 1:
_socket
=
Socket
(
s
.
accept
()[
0
])
finally
:
s
.
close
()
try
:
app
,
=
app_set
except
ValueError
:
app
=
None
getPdb
(
stdin
=
_socket
,
stdout
=
_socket
).
set_trace
()
app
# this is Application instance
app
# this is Application instance
(see 'app_set' if there are several)
f
=
sys
.
_getframe
(
3
)
try
:
while
f
.
f_code
.
co_name
!=
'run'
or
\
f
.
f_locals
.
get
(
'self'
).
__class__
.
__name__
!=
'Application'
:
f
=
f
.
f_back
threading
.
Thread
(
target
=
pdb
,
args
=
(
f
.
f_locals
[
'self'
],)).
start
()
finally
:
del
f
app_set
=
sys
.
modules
[
'neo.client.app'
].
app_set
except
KeyError
:
f
=
sys
.
_getframe
(
3
)
try
:
while
f
.
f_code
.
co_name
!=
'run'
or
\
f
.
f_locals
.
get
(
'self'
).
__class__
.
__name__
!=
'Application'
:
f
=
f
.
f_back
app_set
=
f
.
f_locals
[
'self'
],
except
AttributeError
:
app_set
=
()
finally
:
del
f
threading
.
Thread
(
target
=
pdb
,
args
=
(
app_set
,)).
start
()
neo/lib/debug.py
View file @
9e026d08
...
...
@@ -44,14 +44,14 @@ def debugHandler(sig, frame):
neo
.
__path__
)
imp
.
load_module
(
'neo.debug'
,
file
,
filename
,
(
suffix
,
mode
,
type
))
def
getPdb
():
def
getPdb
(
**
kw
):
try
:
# try ipython if available
import
IPython
shell
=
IPython
.
terminal
.
embed
.
InteractiveShellEmbed
()
return
IPython
.
core
.
debugger
.
Pdb
(
shell
.
colors
)
return
IPython
.
core
.
debugger
.
Pdb
(
shell
.
colors
,
**
kw
)
except
(
AttributeError
,
ImportError
):
import
pdb
return
pdb
.
Pdb
()
return
pdb
.
Pdb
(
**
kw
)
_debugger
=
None
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment