Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions bin/nipype_crash_search
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/usr/bin/env python
#!python
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please explain the rationale for this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"#!python" is being used in the other scripts, e.g., nipype_display_crash.
I tought about it and I am not sure if "#!/usr/bin/env python" works on Windows (if there is any Windows user here).

"""Search for tracebacks inside a folder of nipype crash
log files that match a given regular expression.

Examples:
nipype_crash_search -d nipype/wd/log -r '.*subject123.*'
"""
import re
import sys
import os.path as op
from glob import glob

Expand Down Expand Up @@ -60,6 +61,7 @@ def display_crash_search(logdir, regex):

if __name__ == "__main__":
from argparse import ArgumentParser, RawTextHelpFormatter

defstr = ' (default %(default)s)'
parser = ArgumentParser(prog='nipype_crash_search',
description=__doc__,
Expand All @@ -71,6 +73,10 @@ if __name__ == "__main__":
default='*',
help='Regular expression to be searched in each traceback.' + defstr)

args = parser.parse_args()
if len(sys.argv) == 1:
parser.print_help()
exit(0)

args = parser.parse_args()
display_crash_search(args.logdir, args.regex)
exit(0)
36 changes: 36 additions & 0 deletions bin/nipype_display_pklz
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!python
"""Prints the content of any .pklz file in your working directory.

Examples:

nipype_print_pklz _inputs.pklz
nipype_print_pklz _node.pklz
"""

def pprint_pklz_file(pklz_file):
""" Print the content of the pklz_file. """
from pprint import pprint
from nipype.utils.filemanip import loadpkl

pkl_data = loadpkl(pklz_file)
pprint(pkl_data)


if __name__ == "__main__":

import sys
from argparse import ArgumentParser, RawTextHelpFormatter

defstr = ' (default %(default)s)'
parser = ArgumentParser(prog='nipype_print_pklz',
description=__doc__,
formatter_class=RawTextHelpFormatter)
parser.add_argument('pklzfile', metavar='f', type=str,
help='pklz file to display')

if len(sys.argv) == 1:
parser.print_help()
exit(0)

args = parser.parse_args()
pprint_pklz_file(args.pklzfile)