I am following a bigquery geospatial guide, and my json file is changed via a jq command. Specifically this one:
cat ~/file1.json | jq -c '.features[]' > converted.json
I'm having difficulties running the equivalent of above in python. I'm using the subprocess module, and it's not working.
cmd = ['cat', './sample.json', '|', 'c', '.features[]']
print(subprocess.check_output(cmd))
the output im getting is this:
cat: |: No such file or directory
cat: -c: No such file or directory
cat: .features[]: No such file or directory
Traceback (most recent call last):
File "/Users/rtom/kml2geo/main.py", line 12, in <module>
result = subprocess.check_output(cmd)
File "/Users/rtom/opt/anaconda3/lib/python3.8/subprocess.py", line 415, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/Users/rtom/opt/anaconda3/lib/python3.8/subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['cat', './sample.json', '|', '-c', '.features[]']' returned non-zero exit status 1.
(base) rtom@Ryans-MacBook-Pro kml2geo %
Any help here?