Closed StFroese closed 11 months ago
You have to convert it to a string, which is (reasonably) simple with a pathlib.Path
object: https://git.rwth-aachen.de/3pia/cms_analyses/common/-/blob/master/tasks/base.py#L103-108
But since pathlib
is part of the python (>=3.4) std-lib, it might be reasonable to support it.
Yes, converting it is not difficult at all :)
At some point one may also want to refactor the whole code to use pathlib.Path
instead of os
stuff. Would clean up the code maybe but not sure if it's worth it
Thanks for opening this!
For the internal path handling it might be better to keep normal strings (some paths are passed down to luigi which doesn't use pathlib, some paths to the gfal2 bindings for remote target access), but I think the law target API should 100% support Path
's being passed to all methods.
@riga thx :)
I was trying to use
pathtlib
'sPath
for my targets since I like the simplicity ofThis stops working when the output method is called, for instance:
This is the case because the
remove_scheme
method in theget_path
method insideLocalFileTarget
expects a stringhttps://github.com/riga/law/blob/ce82c5f566b853a7ec24881663669f8344445846/law/target/file.py#L505-L508
@riga Do you want this to be an option for the user to use pathlib for example or should the user fix this themself by converting to a str?
Quick fix would be something like this: Before: https://github.com/riga/law/blob/ce82c5f566b853a7ec24881663669f8344445846/law/target/file.py#L481-L486
After