uvacw / inca

24 stars 6 forks source link

Fixgzip #398

Closed damian0604 closed 6 years ago

damian0604 commented 6 years ago

This PR fixes an issue with exporting gzipped JSON files, resulting in corrupt files (even though they seemed OK first). This was due to legacy python2 compatible code, and can be prevented by explicitly using text mode instead of binary mode.

The following should now be BOTH possible:

myinca.importers_exporters.export_json_file(query='WHATEVER', compression='gz')

myinca.importers_exporters.export_json_file(query='WHATEVER')

The first command should result in a json.gz file that can be uncompressed on the linux command line with

gunzip filename.json.gz

The same should work with export_json_files (plural)