Skip to content

Commit

Permalink
Use sys.argv instead of hardcoded filename
Browse files Browse the repository at this point in the history
So you can it from the command line
  • Loading branch information
endolith committed Oct 23, 2022
1 parent bfbe590 commit f49c490
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion json2kml.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@
import codecs
import html

inputFile = "Saved Places.json"
try:
inputFile = sys.argv[1]
except IndexError:
print("Usage: python json2kml.py filename.json")
exit(1)

outputFile = f'{inputFile[:-5]} [json2kml.py].kml'

# JSON Encoding is UTF-8. Change stdout to UTF-8 to prevent encoding error
Expand Down

0 comments on commit f49c490

Please sign in to comment.