WTF python suddenly function must be defined physically in the file ahead of use?

This commit is contained in:
benjamin melançon 2021-05-25 16:00:09 -04:00
parent f7097af7b8
commit cab8f0c8f1

View file

@ -7,6 +7,11 @@ config = configparser.ConfigParser()
config['pomodoro'] = {}
pomodoro = config['pomodoro']
def write():
with open('settings.ini', 'w') as configfile:
config.write(configfile)
if not os.path.isfile('settings.ini'):
# Set some essential initial values.
# pomodoro['logfile'] = '~/Projects/agaric/python/pomodoroprompt/log/2021.csv'
@ -17,10 +22,6 @@ if not os.path.isfile('settings.ini'):
config.read('settings.ini')
def write():
with open('settings.ini', 'w') as configfile:
config.write(configfile)
def pomodoro_logfile():
return config['pomodoro']['logfile']