larsyencken / csvdiff

Generate a diff between two tabular datasets expressed in CSV files.
BSD 3-Clause "New" or "Revised" License
132 stars 31 forks source link

Error: Invalid value for "FROM_CSV": #46

Closed AthreyVinay closed 5 years ago

AthreyVinay commented 5 years ago

Lars - I have 2 csv files and have initialised 2 variables to hold the paths respectively : csv_file1 = '/home/notex/extractors/ccar/output/CCARFRY1420171231.csv' csv_file2 = '/home/notex/extractors/ccar/output/CCAR-vFRY14-20180331.csv'

Also ran a : import os.path os.path.exists(csv_file1 ) which returns true.

But here : !csvdiff --style=pretty --output=diff.json element_type,element_name,parent_category csv_file1 csv_file2 I am getting this : Error: Invalid value for "FROM_CSV": Path "csv_file1" does not exist.

Is this a known bug? Thanks in advance.

AthreyVinay commented 5 years ago

closing now - since I was able to get this working with the API call.

larsyencken commented 5 years ago

Ah, it's not a bug, it's actually an issue when blending python and shell code in IPython.

You wanted the !csvdiff ... command to expand csv_file1 to the value of your variable, but that's not the default behavior in IPython. It was really looking for a file called csv_file1, which naturally didn't exist. With curly brackets you can get it to fill in the variables:

!csvdiff --style=pretty --output=diff.json element_type,element_name,parent_category {csv_file1} {csv_file2}