Cant save configparser file that is included in the exe wiith my python script

22 Views Asked by At

I have included a .ini file with my my python script in a exe and i cant load the changes to the ini file after reopening my exe. The ini file goes back to scratch each time i open. I can see the changes happend inside the ini in the temp/_MEI folder. This works perfectly inside pycharm editor. I also don't want to store the ini file locally on the computer, I want to be able to move the exe between USB sticks and computers and still keep the settings.

I have tried closing the file and not closing it but didn't help

bundle_dir = sys._MEIPASS 
configpath = os.path.join(bundle_dir, "file.ini")

config.set('keys', x, y)
        with open(configpath, "w+") as conf:
            config.write(conf)
        conf.close()
0

There are 0 best solutions below