Sep-06-2018, 07:59 PM
Hello, I was just testing changing values in .ini files.
I read forums and most people were saying that configparser is the best module to do so.
I've read on some forums and I wanted to try to do it myself
But this error comes out:
I read forums and most people were saying that configparser is the best module to do so.
I've read on some forums and I wanted to try to do it myself
But this error comes out:
Error:Traceback (most recent call last):
File "C:\Users\P1tey\Desktop\test.py", line 10, in <module>
update_setting("C:\\Users\\P1tey\\Desktop\\tests.ini", "Testsection", "resolutiony", "1440 x 1080")
File "C:\Users\P1tey\Desktop\test.py", line 5, in update_setting
config = get_config(path)
NameError: name 'get_config' is not defined
Here is the code:import configparser import os def update_setting(path, section, setting, value): config = get_config(path) config.set(section, setting, value) with open(path, "wb") as config_file: config.write(config_file) update_setting("C:\\Users\\P1tey\\Desktop\\tests.ini", "Testsection", "resolutiony", "1440 x 1080")And also, is there any more effective way to do the same thing?