fspath.debug module

Small collection for debugging and introspection purpose.

class fspath.debug.Console(local_ns=None, global_ns=None, filename='<console>')[source]

Bases: InteractiveConsole

A simple interactive console.

EOF = None
raw_input(prompt='')[source]

Write a prompt and read a line.

The returned line does not include the trailing newline. When the user enters the EOF key sequence, EOFError is raised.

The base implementation uses the built-in function input(); a subclass may replace this with a different implementation.

classmethod run(local_ns=None, global_ns=None, banner=None, filename='<console>', frame=None, EOF=None)[source]

Start console

Without setting explicit namespaces (local_ns, global_ns), the namespaces from the current code-frame are uused.

def foo(arg1):
    ...
    Console.run()
runcode(code)[source]

Execute a code object.

When an exception occurs, self.showtraceback() is called to display a traceback. All exceptions are caught except SystemExit, which is reraised.

A note about KeyboardInterrupt: this exception may occur elsewhere in this code, and may not always be caught. The caller should be prepared to deal with it.

write(data)[source]

Write a string.

The base implementation writes to sys.stderr; a subclass may replace this with a different implementation.

class fspath.debug.RemoteConsole(local_ns=None, global_ns=None, filename='<console>')[source]

Bases: Console

A simple remote console.

Works just like the Console except the console can be reached from a remote (terminal session).

EOF = 'EOF'
interact(port, addr='127.0.0.1', banner=None)[source]

Closely emulate the interactive Python console.

The optional banner argument specifies the banner to print before the first interaction; by default it prints a banner similar to the one printed by the real Python interpreter, followed by the current class name in parentheses (so as not to confuse this with the real interpreter – since it’s so close!).

The optional exitmsg argument specifies the exit message printed when exiting. Pass the empty string to suppress printing an exit message. If exitmsg is not given or None, a default message is printed.

classmethod run(port, local_ns=None, global_ns=None, banner=None, filename='<console>', frame=None, EOF=None)[source]

Starts a remote console

The first argument is needed, it is the port number for the remote connection.

def foo(arg1):
    ...
    RemoteConsole.run(4444) # terminal on port 4444

The string ‘EOF’ ends the remote session.

class fspath.debug.RemotePdb(port, addr='127.0.0.1')[source]

Bases: Pdb

Simple remote PDB

do_EOF(arg)

Stop all operation on continue.

do_c(arg)

Stop all operation on continue.

do_cont(arg)

Stop all operation on continue.

do_continue(arg)[source]

Stop all operation on continue.

do_exit(arg)

Stop all operation on continue.

do_quit(arg)

Stop all operation on continue.

shutdown()[source]

shutdown PDB’s’ REPL

fspath.debug.rtrace(port=4444, addr='127.0.0.1', frame=None)[source]

A breakpoint, starting a RemotePdb session. Default port ist 4444

fspath.debug.trace(frame=None)[source]

A breakpoint starting a Pdb session.