Python Debug Methods

1. print
>>> print “hello”

2. logging module
(setup debug level)
>>> logging.debug()
>>> logging.error()

3. import/reload
>>> import test
(change code)
>>> reload(test)

4. exec
>>> d = {}
>>> exec(file(‘/tmp/’), d)
>>> d.get(‘foo’)(args=’hello’)

5. eval
>>> evel(‘foo(args=’hello’), d)

6. python -i
python -i
>>> dir()

7. debug tools
pdb  (the usage is very like gdb: b,c,n,l,r,p)


BTW, shell debug:

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.