diff --git a/.gitignore b/.gitignore index 8c1be54..6be6546 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,6 @@ /test.py -/piecharttest.py \ No newline at end of file +/piecharttest.py +*.idea +*.vscode +*output +*.json diff --git a/Converter.py b/Converter.py index c183bc7..d58c8a2 100644 --- a/Converter.py +++ b/Converter.py @@ -34,6 +34,9 @@ with open(fileName) as json_file: data = json.load(json_file) + if data=={}: + print("data is empty") + exit(-1) #0 @@ -67,6 +70,8 @@ def BarGraph(): what = str(input("Do you want to save this? (y/n): ")).lower() if what == "y": name = str(input("Enter the name for the file: ")) + if not os.path.exists("./output/"): + os.mkdir("./output/") plt.savefig("./output/" + name) print("File saved!") plt.show() diff --git a/README.md b/README.md index 87a6cf4..8caa648 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,6 @@ ## Steps 1. Export your WakaTime coding activity as json [here](https://wakatime.com/settings/account) -2. Replace the data.json file with the new json file +2. Put your json file in `/input` folder, one file per run. 3. Run Converter.py 4. Choose your option diff --git a/input/.gitkeep b/input/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/input/data.json b/input/data.json deleted file mode 100644 index 0967ef4..0000000 --- a/input/data.json +++ /dev/null @@ -1 +0,0 @@ -{}