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

Closed
d4nys3k opened this issue Apr 4, 2024 · 2 comments
Closed

ifupdown2 - python 3.12 compability #296

d4nys3k opened this issue Apr 4, 2024 · 2 comments

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 :)

KoffieNu added a commit to KoffieNu/ifupdown2 that referenced this issue Jul 9, 2024
Since pythong 3.2 readfp needs to be replaced by read_file.
Python 3.12 dropped this function.

Patch provided as PR by me, as original reported failed to do
so since 4-4-2024 and my systems break due to this issue.
KoffieNu added a commit to KoffieNu/ifupdown2 that referenced this issue Jul 9, 2024
Since python 3.2, readfp needs to be replaced by read_file.
Python 3.12 dropped the readfp function.

Patch provided as PR by me, as the original reporter failed to do
so since 4-4-2024 and my systems break due to this issue.
@KoffieNu
Copy link
Contributor

KoffieNu commented Jul 9, 2024

Patch provided as PR by me, as original reported failed to do
so since 4-4-2024 and my systems break due to this issue.

julienfortin added a commit that referenced this issue Jul 9, 2024
Bug #296: python 3.12 compability
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

3 participants