try:
os.mkdir('data')
except FileExistsError:
os.chdir('data')
data = {'teaminfo': []}
data['teaminfo'].append({
'managername': '',
'teamname': '',
'currentmoney': 100000
})
get_file_name()
with open(filename, 'w') as outfile:
json.dump(data, outfile, indent=4)
def submit():
os.chdir('..')
os.chdir('data')
global filename
print(filename)
parsed = json.loads(filename)
print(json.dumps(parsed, indent=4, sort_keys=True))
Error:
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
I would like to open the json file, and then edit "managername" and "teamname" with the input the user gives (haven't implemented it yet, because it cannot print the json by itself first).
The full error says that it happens at like 68, which is parsed = json.loads(filename)
.