Writing log file fails if only filename given
widdowquinn opened this issue · comments
Summary:
When using -l <FILENAME>
if <FILENAME>
does not contain a valid directory path, a FileNotFoundError
is thrown.
Description:
Attempting to open the log file splits the path to identify the parent directory/ies. If no leading path to a file in the current directory is given, e.g. myfile.log
instead of ./myfile.log
, os.makedirs()
attempts to create a directory ''
, which fails.
The solution may be to move to pathlib
for all filepath handling.
Reproducible Steps:
Any ncfp
command with -l myfile.txt
in the command.
Current Output:
A FileNotFound
error
Expected Output:
No FileNotFound
error
I am no longer able to reproduce this locally, but a related bug exists: the logfile is empty unless the -v
flag is set.
% ncfp -l myfile.log -s ../tests/fixtures/sequences/input_uniprot_stockholm_small.fasta ncfp_out ncfp@dev.null
% ls -ltrh myfile.log [11:37:25]
-rw-r--r-- 1 lpritc staff 0B 21 May 11:36 myfile.log
% ncfp -v -l myfile.log -s ../tests/fixtures/sequences/input_uniprot_stockholm_small.fasta ncfp_out ncfp@dev.null
ls -ltrh myfile.log [11:38:52]
-rw-r--r-- 1 lpritc staff 4.9K 21 May 11:38 myfile.log