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

createmodule.py fails when used with Python 3. #315

Closed
awehrfritz opened this issue Feb 17, 2020 · 2 comments
Closed

createmodule.py fails when used with Python 3. #315

awehrfritz opened this issue Feb 17, 2020 · 2 comments
Milestone

Comments

@awehrfritz
Copy link
Contributor

The createmodule.py script fails when used with Python 3.

Here the patch to fix this:

--- createmodule.py.old	2020-02-17 17:44:36.598753762 +1100
+++ createmodule.py.new	2020-02-17 17:45:08.855552992 +1100
@@ -211,10 +211,10 @@ if chdir is not None:
 # Function to format output line with tabs and substituting prefix
 def formatline(item, key, value=None):
     print(item, end=' ')
-    print("\t"*(2-(len(item)+1)/8), end=' ')
+    print("\t"*(2-(len(item)+1)//8), end=' ')
     print(key, end=' ')
     if value is not None:
-        print("\t"*(3-(len(key)+1)/8), end=' ')
+        print("\t"*(3-(len(key)+1)//8), end=' ')
         if prefix is not None:
             # Prefer usage of regular expression to perform a none
             # case-sensitive substitution (cygwin vs cmd.exe)
@@ -227,7 +227,7 @@ def formatline(item, key, value=None):
 
 # Paths first, grouped by variable name
 for sepkey in prependpath.keys():
-    pathkeys = prependpath[sepkey].keys()
+    pathkeys = list(prependpath[sepkey].keys())
     pathkeys.sort()
     for key in pathkeys:
         if sepkey == ":":
@@ -236,7 +236,7 @@ for sepkey in prependpath.keys():
             formatline("prepend-path --delim %s" % sepkey,key,prependpath[sepkey][key])
 
 for sepkey in appendpath.keys():
-    pathkeys = appendpath[sepkey].keys()
+    pathkeys = list(appendpath[sepkey].keys())
     pathkeys.sort()
     for key in pathkeys:
         if sepkey == ":":

I tested this with Python2 and Python3 on Fedora 31 and it works for my case.

@xdelaruelle
Copy link
Member

@awehrfritz Thanks for your contribution.

@awehrfritz
Copy link
Contributor Author

Thanks @xdelaruelle for fixing this right away!

@xdelaruelle xdelaruelle added this to the 4.5 milestone Feb 18, 2020
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