kivy / kivy

Open source UI framework written in Python, running on Windows, Linux, macOS, Android and iOS
https://kivy.org
MIT License
17k stars 3.04k forks source link

`ConfigParser.write` takes 1 positional argument but 2 were given #8678

Closed marinelay closed 3 weeks ago

marinelay commented 1 month ago

Software Versions

Describe the bug

https://github.com/kivy/kivy/blob/c0d4894384abb81cf4729984a1eaa4c437d266da/kivy/__init__.py#L482-L487

Config is object of ConfigParser and ConfigParser.write method does not require any positional arguments. Thus, it always raises TypeError: write() takes 1 positional argument but 2 were given at line 484. I believe setting self.filename as kivy_config_fn is more accurate like this:

Config.filename = kivy_config_fn
Config.write()

I wonder it is the right behavior.

Expected behavior

Config.filename = kivy_config_fn
Config.write()

To Reproduce

from kivy.config import Config

with open("abc", 'w') as fd:
        Config.write(fd)

Code and Logs and screenshots https://github.com/kivy/kivy/blob/c0d4894384abb81cf4729984a1eaa4c437d266da/kivy/__init__.py#L482-L487

misl6 commented 1 month ago

Nice catch!

I can confirm the issue is reproducible with python examples/demo/touchtracer/main.py -m monitor --save I guess no one used the --save option for the last ~12 years? 😅

Would you like to make a PR for it?

misl6 commented 3 weeks ago

Fixed via #8681