Skip to content

← programming package

Print

Print the given data.

If data is not provided, the (editable) string port is used. The data (or string) can be a format string with %s etc placeholders, in which case the arguments are taken from the arg0-arg9 ports. If a non-string object is provided as data, the object prints by default with indentation, and long arrays can optionally be abbreviated using the abbrev option (True by default). The node can write to a number of destinations that are selectable by the dest port: debug, info, warning, error, and fatal generate log messages like those emitted by any other node. The stdout and stderr options write to the command line output and error streams, respectively, which can be useful when running a pipeline from a command line script. You can additionally write the output to a file by wiring the output port to the ExportText node. Print will by default append a newline character at the end, unless the "end" port is overridden, in which case multiple successive print statements append to the same line (except for log destinations). Version 1.4.2

Ports/Properties

data

Data to print.

verbose name
Data
default value
None
port type
DataPort
value type
object (can be None)
data direction
IN

output

Printed output.

verbose name
Output
default value
None
port type
DataPort
value type
str (can be None)
data direction
OUT

arg1

Format argument 1.

verbose name
Arg1
default value
None
port type
DataPort
value type
object (can be None)
data direction
IN

arg2

Format argument 2.

verbose name
Arg2
default value
None
port type
DataPort
value type
object (can be None)
data direction
IN

arg3

Format argument 3.

verbose name
Arg3
default value
None
port type
DataPort
value type
object (can be None)
data direction
IN

arg4

Format argument 4.

verbose name
Arg4
default value
None
port type
DataPort
value type
object (can be None)
data direction
IN

arg5

Format argument 5.

verbose name
Arg5
default value
None
port type
DataPort
value type
object (can be None)
data direction
IN

arg6

Format argument 6.

verbose name
Arg6
default value
None
port type
DataPort
value type
object (can be None)
data direction
IN

arg7

Format argument 7.

verbose name
Arg7
default value
None
port type
DataPort
value type
object (can be None)
data direction
IN

arg8

Format argument 8.

verbose name
Arg8
default value
None
port type
DataPort
value type
object (can be None)
data direction
IN

arg9

Format argument 9.

verbose name
Arg9
default value
None
port type
DataPort
value type
object (can be None)
data direction
IN

string

String to print. This string is used when no data is given, or used to combine multiple incoming data (through the arg0 to arg9 ports) with a format string. You can do this either by using generic placeholders (%s for a string, %i for an integer, %f or %.2f for a float (with 2-digit precision), etc., in the string, which will be sequentially replaced by the data coming into the arg0 to arg9 ports (so the first % placeholder is replaced by the data coming into arg0, the second by the data coming into arg1, and so on). I.e., Num trials: %d, Num errors: %d.

verbose name
Print String
default value
port type
StringPort
value type
str (can be None)

limit

Limit prints of large collections to at most this many items. This will print only the leading and trailing limit items, with an ellipsis in the middle.

verbose name
Trim Items Beyond
default value
None
port type
IntPort
value type
int (can be None)

summarize

If True, print summaries of certain fields, such as arrays and chunk properties.

verbose name
Summarize Data
default value
False
port type
BoolPort
value type
bool (can be None)

handle_none

How to handle an incoming value of None. If print, None is printed as the string '(none)'. If ignore, None is ignored (replaced by an empty string), if skip, the node prints no output. If error, an exception is raised and log message printed.

verbose name
Handle None Values
default value
print
port type
EnumPort
value type
str (can be None)

dest

Destination for the output. The debug/info/warn/error/critical options will go to NeuroPype's logging facility with the corresponding log level, which is also written to disk and is accessible to applications interacting with NeuroPype's API. The stdout/stderr options will go to command line/terminal output/error streams, which is more useful when a pipeline is run from a commandline script. The result-only option will only return the string result via the "output" port ONLY and not also print it (note the printed string is always available on this port regardless of the destination setting).

verbose name
Output Destination
default value
info
port type
EnumPort
value type
str (can be None)

flush

When printing to a stream, flush any buffers after the print.

verbose name
Flush Output Stream
default value
True
port type
BoolPort
value type
bool (can be None)

end

String to print after the data. Defaults to a newline. This can be set to an empty string to print without a newline (note through that this will not work with log destinations - in this case you may want to first concatenate any strings and then write the result to a log.

verbose name
Append End String
default value
port type
StringPort
value type
str (can be None)

respect_escape_seqs

If True, escape sequences in the string are processed. This is useful when the string is a format string that contains escape sequences, such as \n for a newline. If False, the string is printed as is.

verbose name
Respect Escape Sequences
default value
True
port type
BoolPort
value type
bool (can be None)

If True, the node will only print the first incoming value and ignore the rest. This is useful if you have a repeating value and only want to output its first occurence (less verbose).

verbose name
Print Once
default value
False
port type
BoolPort
value type
bool (can be None)

arg0

Format argument 0.

verbose name
Arg0
default value
None
port type
DataPort
value type
object (can be None)
data direction
IN

set_breakpoint

Set a breakpoint on this node. If this is enabled, your debugger (if one is attached) will trigger a breakpoint.

verbose name
Set Breakpoint (Debug Only)
default value
False
port type
BoolPort
value type
bool (can be None)

metadata

User-definable meta-data associated with the node. Usually reserved for technical purposes.

verbose name
Metadata
default value
{}
port type
DictPort
value type
dict (can be None)