configparser.NoSectionError: No section: 'general_info'

Viewed 23

I have created an exe file from .py file and within that code, i retrieve a value from config.ini file. When i convert the .py to .exe file and double click on it, it works fine. But when create a task scheduler to run that exe file on windows start up, i receive an error:

configparser.NoSectionError: No section: 'general_info'

Noting that the section already exists and as mentioned above when run the exe file by double click on it, it works fine

code:

import time
import os
import subprocess
from configparser import ConfigParser, RawConfigParser
 
thisfolder = os.getcwd()  
initfile = os.path.join(thisfolder, 'config.ini').replace('\\', '\\\\')
 
config = RawConfigParser()
 
config.read(initfile)
check_every_minutes = int(config.get('general_info', 'check_every_minutes').strip()) * 60

config.ini:

[general_info]
check_every_minutes = 1

Does anyone have an idea?

0 Answers
Related