Code here (left out the unrelated Kivy stuff):
from kivy.app import App
from kivy.core.window import Window
from kivy.uix.widget import Widget
from configparser import ConfigParser
import os
class MIDIApp(App):
def build(self):
self.config = ConfigParser()
self.config.read('values.ini')
Window.size = Window.size
return MainWindow()
def input1_comp_move(self, value):
print(int(value))
def input1_save_comp_value(self, value):
self.config['Input1']['comp'] = str(value)
print(str(value))
with open('values.ini', 'w') as config_file:
ConfigParser.write(config_file)
print('Input1 comp value is ', value)
class MainWindow(Widget):
pass
if __name__ == '__main__':
MIDIApp().run()
When I run this I get the error ConfigParser.write(self.config_file)
TypeError: write() missing 1 required positional argument: 'fp'
And when I debug by leaving it blank it requires 2 positional arguments 'self'
and 'filename'
, it didn't require that when I tried to used this another program. What am I missing?
It should be
self.config.write(self.config_file)
or, if you insist,ConfigParser.write(self.config, self.config_file)
.
Thanks ForceBru