OasisLMF / ODS_Tools

Python package supporting ODS OpenDataStandards (OED / ORD)
3 stars 1 forks source link

Support for relative paths in the transformation config file #149

Open carlfischerjba opened 1 month ago

carlfischerjba commented 1 month ago

Issue Description

The yaml config file for ods_tools transform requires paths to be relative to the current directory of the shell where the ods_tools transform command is being run from rather than the location of the config file. This isn't intuitive for the user and requires them to either cd into the directory containing the config file or to use absolute paths in the config file (for instance for transformations.loc.extractor.options.sql_statement which points to a file containing a SQL statement).

Additionally the error when a file is not found is unhelpful as it includes neither the name of the file nor the path at which it cannot be found. In fact it suggests that it's a .py file that is missing when that's just the line of code that raised the error. Example:

$ ods_tools transform --config-file /mnt/workspace/LM3932_cede_conversion/config.yaml
2024-10-28 15:40:09,947 - ERROR - FileNotFoundError(2, 'No such file or directory'), line 160 in /home/carl/venvs/myvenv/lib/python3.10/site-packages/ods_tools/odtf/controller.py

By contrast, transformations.loc.loader.options.path (the path for the OED location file) does appear to be treated relative to the config file regardless of where the command is run from.

Steps to Reproduce (Bugs only)

1. 2. 3.

Version / Environment information

Example data / logs