Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 46 lines (30 sloc) 1.163 kB
500a0f1 @amoffat readme
authored
1 Ever want to know what the hell that python script is doing? Enter the
8c73e80 @amoffat updating readme
authored
2 Inspect Shell. Inspect Shell lets you print/alter globals and run functions
1686a5e @amoffat restructring readme
authored
3 without interrupting the running script. Now with auto-complete and
4 command history (only on linux).
8c73e80 @amoffat updating readme
authored
5
6 Inspect Shell is not a pdb-style debugger.
1cfb363 @amoffat readme
authored
7
8 How to set up
9 =============
10
500a0f1 @amoffat readme
authored
11 Put inspect_shell.py in the directory of the script you want to inspect.
1cfb363 @amoffat readme
authored
12
13 Add
7a58c8b @amoffat readme
authored
14
1cfb363 @amoffat readme
authored
15 ```python
16 import inspect_shell
17 ```
7a58c8b @amoffat readme
authored
18
500a0f1 @amoffat readme
authored
19 to the top of that script.
1cfb363 @amoffat readme
authored
20
4529d9c @amoffat readme
authored
21 **That's it.**
1cfb363 @amoffat readme
authored
22
23 How to use
24 ==========
25
500a0f1 @amoffat readme
authored
26 Run your script. Then run:
1cfb363 @amoffat readme
authored
27
7a58c8b @amoffat readme
authored
28 $ python inspect_shell.py
1cfb363 @amoffat readme
authored
29
500a0f1 @amoffat readme
authored
30 You'll now have an interactive shell to your script. Anything you do will
1686a5e @amoffat restructring readme
authored
31 affect the script **on the fly.** However, be mindful that Inspect Shell provides
32 *no locking* when you're altering global namespace of your script. The
33 best uses for Inspect Shell are for passive inspection of objects.
8c73e80 @amoffat updating readme
authored
34
35 Example
36 =======
37 $ rs:1234> print some_module
38 <module 'some_module' from '/whatever'>
39
40 $ rs:1234> print some_module.some_config_value
41 492
42
43 $ rs:1234> some_module.some_config_value = 292
44
45 ...And your script keeps on running, but with whatever changes you made from the shell.
Something went wrong with that request. Please try again.