TypeError: unlink() got an unexpected keyword argument 'missing_ok'
Closed this issue · 4 comments
os.unlink()
was given a keyword argument, missing_ok
, in Python 3.8 but NiWorkflows
1.5.x still supports Python 3.7.
Commit 518b360 introduced this keyword, causing an error to be thrown in nipreps/nirodents#55, whose Docker image is still in 3.7. Exemplary error trace from one of the three errors:
"""
Traceback (most recent call last):
File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/plugins/multiproc.py", line 344, in _send_procs_to_workers
self.procs[jobid].run(updatehash=updatehash)
File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py", line 516, in run
result = self._run_interface(execute=True)
File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py", line 635, in _run_interface
return self._run_command(execute)
File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py", line 741, in _run_command
result = self._interface.run(cwd=outdir)
File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/base/core.py", line 419, in run
runtime = self._run_interface(runtime)
File "/usr/local/miniconda/lib/python3.7/site-packages/niworkflows/interfaces/bids.py", line 672, in _run_interface
out_file.unlink(missing_ok=True)
TypeError: unlink() got an unexpected keyword argument 'missing_ok'
"""
Are there plans to stop supporting 3.7 (meaning I should bump NiRodents to 3.8) or is there a workaround?
Ugh. I didn't realize that I was depending on new behavior. I thought we were testing all supported versions. I'll submit a PR.
That said, it's probably a good idea to bump up to 3.9 or even 3.10 when you get the opportunity. 3.7 will be end-of-life in another year or so.
nope - 3.7 isn't EOL til mid 2023 (https://endoflife.date/python)
we should probably replace those with:
# 3.7 backport
try:
out_file.unlink()
except FileNotFoundError:
pass
edit - 5 mins late on this...
Sorry to be the bearer of bad news... Thanks for the speedy replies. I'll look to bump NiRodents up anyway, I guess mid-2023 will come round before we know it.
nope - 3.7 isn't EOL til mid 2023 (https://endoflife.date/python)
we should probably replace those with:
# 3.7 backport try: out_file.unlink() except FileNotFoundError: passedit - 5 mins late on this...
Sure - Considering the bugfix is so cheap, I'd go with it.
However, I think we should stick with Numpy's deprecation schedule, which dropped Python 3.7 last December. Our Docker images will start breaking soon if some change preempts the use of cached layers (see MRIQC's setup.cfg
for an example on the efforts to keep support for 3.7 ongoing)