IOError when passing a wildcard input file pattern that has only one match to a tool

Issue #40 resolved
Thomas Gilgenast created an issue

If you run a command like

$ lib5c plot heatmap 'kr/*.counts' kr/%s_%r.png

expecting it to parallelize over countsfiles, but the pattern 'kr/*.counts' only matches one countsfile, then this condition in lib5c.tools.helpers.resolve_parallel() will not be tripped:

    if len(infiles) > 1:

and the wildcard will be left in the string literal. You will then get

  File "...\lib5c\parsers\counts.py", line 250, in load_counts
    with open(countsfile, 'r') as handle:
IOError: [Errno 22] invalid mode ('r') or filename: 'kr/*.counts'

since the counts parser tries to load from the string literal, not the glob-expanded version.

This exact situation actually does come up when walking through the command line tutorial.

The current workaround is to simply specify the filename (or let the shell expand the wildcard) when the pattern is expected to only match one replicate.

Comments (2)

  1. Log in to comment