When I try to convert from a csv to a datafile, I get the following error. Conversion from a datapackage to a datafile using the same source data works fine.
Solution
Looks like otoole is trying to find data for result parameters when reading in the input data. A line needs to be added (or modified) that tells otoole when reading data, only look for values tagged as a param or set in the config.yaml. Also, a test should be added that checks for this issue.
System Information
Otoole Version: Develop branch
OS: Linux
Error Message
Traceback (most recent call last):
File "/home/trevorb1/.local/bin/otoole", line 8, in <module>
sys.exit(main())
File "/home/trevorb1/repositories/otoole/src/otoole/cli.py", line 336, in main
args.func(args)
File "/home/trevorb1/repositories/otoole/src/otoole/cli.py", line 197, in conversion_matrix
context.convert(args.from_path, args.to_path)
File "/home/trevorb1/repositories/otoole/src/otoole/input.py", line 121, in convert
inputs, default_values = self._read(input_filepath, **kwargs)
File "/home/trevorb1/repositories/otoole/src/otoole/input.py", line 103, in _read
return self._read_strategy.read(filepath, **kwargs)
File "/home/trevorb1/repositories/otoole/src/otoole/read_strategies.py", line 178, in read
df = pd.read_csv(csv_path)
File "/home/trevorb1/.local/lib/python3.8/site-packages/pandas/util/_decorators.py", line 311, in wrapper
return func(*args, **kwargs)
File "/home/trevorb1/.local/lib/python3.8/site-packages/pandas/io/parsers/readers.py", line 678, in read_csv
return _read(filepath_or_buffer, kwds)
File "/home/trevorb1/.local/lib/python3.8/site-packages/pandas/io/parsers/readers.py", line 575, in _read
parser = TextFileReader(filepath_or_buffer, **kwds)
File "/home/trevorb1/.local/lib/python3.8/site-packages/pandas/io/parsers/readers.py", line 932, in __init__
self._engine = self._make_engine(f, self.engine)
File "/home/trevorb1/.local/lib/python3.8/site-packages/pandas/io/parsers/readers.py", line 1216, in _make_engine
self.handles = get_handle( # type: ignore[call-overload]
File "/home/trevorb1/.local/lib/python3.8/site-packages/pandas/io/common.py", line 786, in get_handle
handle = open(
FileNotFoundError: [Errno 2] No such file or directory: 'data/AnnualEmissions.csv'
Description
When I try to convert from a csv to a datafile, I get the following error. Conversion from a datapackage to a datafile using the same source data works fine.
Solution
Looks like otoole is trying to find data for result parameters when reading in the input data. A line needs to be added (or modified) that tells otoole when reading data, only look for values tagged as a
param
orset
in theconfig.yaml
. Also, a test should be added that checks for this issue.System Information
Otoole Version: Develop branch OS: Linux
Error Message