Skip to content

Commit f49c490

Browse files
committed
Use sys.argv instead of hardcoded filename
So you can it from the command line
1 parent bfbe590 commit f49c490

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

json2kml.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@
1414
import codecs
1515
import html
1616

17-
inputFile = "Saved Places.json"
17+
try:
18+
inputFile = sys.argv[1]
19+
except IndexError:
20+
print("Usage: python json2kml.py filename.json")
21+
exit(1)
22+
1823
outputFile = f'{inputFile[:-5]} [json2kml.py].kml'
1924

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

0 commit comments

Comments
 (0)