Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ifupdown2 - python 3.12 compability #296

Open
d4nys3k opened this issue Apr 4, 2024 · 1 comment
Open

ifupdown2 - python 3.12 compability #296

d4nys3k opened this issue Apr 4, 2024 · 1 comment

Comments

@d4nys3k
Copy link

d4nys3k commented Apr 4, 2024

I noticed ifupdown2 stopped working after upgrading to Python3.12. It fails to bring up all interfaces with:
error: main exception: 'RawConfigParser' object has no attribute 'readfp'

According to the documentation, readfp can be replaced by read_file since Python 3.2. Python 3.12 removes this object. After local modification of ifupdown/main.py (see diff below) I managed ifupdown2 to resume operation as expected in my envinronment.

--- ifupdown/main.py.orig	2020-08-28 16:01:19.000000000 +0200
+++ ifupdown/main.py	2024-04-04 19:15:45.575869366 +0200
@@ -139,7 +139,7 @@
         configStr = '[ifupdown2]\n' + config
         configFP = io.StringIO(configStr)
         parser = configparser.RawConfigParser()
-        parser.readfp(configFP)
+        parser.read_file(configFP)
         configmap_g = dict(parser.items('ifupdown2'))
@julienfortin
Copy link
Contributor

@d4nys3k can you submit the patch as a PR? So you get credit for finding the issue and i click merge it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants