Closed xuzhougeng closed 4 years ago
Given a error message as a example
Traceback (most recent call last):
File "/opt/sysoft/Python-3.7.0/bin/xpclr", line 4, in <module>
__import__('pkg_resources').run_script('xpclr==1.1.2', 'xpclr')
File "/opt/sysoft/Python-3.7.0/lib/python3.7/site-packages/pkg_resources/__init__.py", line 658, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/opt/sysoft/Python-3.7.0/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1445, in run_script
exec(script_code, namespace, namespace)
File "/opt/sysoft/Python-3.7.0/lib/python3.7/site-packages/xpclr-1.1.2-py3.7.egg/EGG-INFO/scripts/xpclr", line 196, in <module>
File "/opt/sysoft/Python-3.7.0/lib/python3.7/site-packages/xpclr-1.1.2-py3.7.egg/EGG-INFO/scripts/xpclr", line 88, in main
AssertionError: No permission to write in the specified directory:
Hi,
Firstly thanks for making a PR. It's great to see someone wanting to contribute to this code.
I'm not sure on the rationale of this change.
Regardless of whether the path is relative or absolute, if you run the xpclr
script from the bin directory you will not have permission to write there.
@hardingnj
If you change the code(https://github.com/hardingnj/xpclr/blob/master/snakemake/Snakefile), from
output:
txt='output/results.txt'
to
output:
txt='results.txt'
you will reproduce the permission error .
Because the outdir = os.path.dirname("results.txt")
will pass a None to outdir
, which will cause AssertionError: No permission to write in the specified directory
.
So, I think it will be better to get the asbolute path of output path , then test whether it is writable.
If the paramter of outdir is not a relative path or absolute path like
--out test
, the program will cause a error of "No permission to write in the specified directory". To avoid this error, we should get the the absolute path firstly.