Skip to content

Commit 9104bab

Browse files
committed
run.command(): Fix operation of -continue
The existing implementation of -continue assumed that, for a list of elements to be provided to subprocess.run(), each element was a string, and therefore string operations could be applied. However with the adoption of pathlib for handling user-specified paths in #2678, an element in this list may be a class derived from those provided in the pathlib module that does not provide string functions.
1 parent 24996a2 commit 9104bab

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

python/mrtrix3/run.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,9 @@ def trigger_continue(self, entries):
124124
for entry in entries:
125125
# It's possible that the file might be defined in a '--option=XXX' style argument
126126
# It's also possible that the filename in the command string has the file extension omitted
127-
if entry.startswith('--') and '=' in entry:
128-
totest = entry.split('=')[1]
129-
else:
130-
totest = entry
127+
totest = entry.split('=')[1] \
128+
if isinstance(entry, str) and entry.startswith('--') and '=' in entry \
129+
else entry
131130
if totest in [ self._last_file, os.path.splitext(self._last_file)[0] ]:
132131
self._last_file = ''
133132
return True

0 commit comments

Comments
 (0)