dotaUpdatesBot icon indicating copy to clipboard operation
dotaUpdatesBot copied to clipboard

Create required .json files on startup

Open zachkont opened this issue 8 years ago • 7 comments

The utils.py module should probably create the grouplist.json, userlist.json, previousblogposts.json, previousmagesunite.json, previouscyborgmatt.json, previousbelvedere.json and previouswykrhm .json and initialize them as json files.

This is a temporary enhancement until #15 is addressed

zachkont avatar Nov 22 '17 15:11 zachkont

Yea, good point, currently if you are setting the project up some parts dont work because the json files don't exist.

TimJentzsch avatar Nov 22 '17 15:11 TimJentzsch

Hello! I was searching for some "beginner" issues and this seems to be a one. I could help, but i wanted to ask a question first. If i understand correctly, this just needs to "create a blank JSON file" right? Or, create a JSON file with some blank variables?

90-008 avatar Dec 11 '17 07:12 90-008

Blank JSON file as in an empty document with opening and closing curly braces and a newline between them. The newline is for formatting purposes only (in case I'm debugging and need to check the saved list for some reason)

zachkont avatar Dec 13 '17 13:12 zachkont

Hi, is this issue still open to fix?

RhysRead avatar Apr 12 '18 22:04 RhysRead

Yeap

zachkont avatar Apr 15 '18 21:04 zachkont

Okay, I will take a look at this later on.

RhysRead avatar Apr 16 '18 05:04 RhysRead

Hey would love to tackle this one if its still open. Seems fairly straightforward.

Not fully sure of the impact of the Utils.py code just yet, so I'm thinking I can just throw it in its own Method, which can be called on setup - rather than having the utils.py file potentially overwrite the existing JSON files every time its called

Update: Created a PR #56 for this - needed to import os.path to the utils.py file for the purpose of checking if the json files already exist before creating them to prevent them getting overwritten. Let me know if you think I should be handling this a different way, or if it needs polishing. Thanks!

BenHargreaves avatar Oct 18 '18 21:10 BenHargreaves