Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upBreakage with Python 3.7: 'str' object has no attribute 'decode' #13
Comments
|
Sigh... I guess so... More if statements, or a wrapper function. Thanks for testing! |
https://docs.python.org/3/whatsnew/3.7.html#changes-in-the-python-api "The struct.Struct.format type is now str instead of bytes." So, put in a wrapper function to handle both scenarios. Thanks Holger Hoffstätte for reporting the issue. Github: Fixes: #13
|
Hi, can you please test the develop branch? I put a little wrapper function in that looks at the type of the result of struct.format. |
|
Looks good, now works with 3.7 as well:
Verified that it also still works with 3.6, giving the same result. Thanks! |
|
Thanks. Now go do less boring things than fs_info ;-] I'm finishing up the big usage / wasted space refactoring, and will probably do a release then, maybe even including the first part of the Turorial. |
https://docs.python.org/3/whatsnew/3.7.html#changes-in-the-python-api "The struct.Struct.format type is now str instead of bytes." So, put in a wrapper function to handle both scenarios. Thanks Holger Hoffstätte for reporting the issue. Github: Fixes: #13
|
With this commit I still fail to import the module:
|
|
This is not the original problem, it's some circular import things go wrong. Which code are you exactly running here? Which git commit? I can't reproduce this. I also have python3.7 here now to test with. |
|
I'm applying the patch over the v9 release. Is it intended only to master? |
|
Ah, yes, then you also need the commit 'Work around circular imports'. To fix this right now for you, I reorganized my develop branch, moved the fixes to the beginning and merged those two commits to master, which means they won't change anymore. I can also release this as 9.1 if you want. |
|
A 9.1 would be great. I'm the maintainer of the Fedora package and an official release would be preferred. Thanks! |
|
Sure, done. I also prepared the debian packages for unstable, so that they're in before python 3.7 moves from debian experimental to unstable. |
|
@knorrie Pushing 9.1 to PyPI would be super appreciated if you find the time! |
|
Ahem, yes. Thanks for the reminder. Will do tonight. |
Hooray, it's Python time💩
Tinkering around with the examples and everything works fine with python 3.6:
Let's try the new hotness:
I dug through the Python 3.7 Changelog and think the relevant change is here:
"The struct.Struct.format type is now str instead of bytes."
Reading the bug discussion it seems this was actually a bug in <3.7, and the new behaviour is "correct". Not sure how to handle this so that it works with any version, maybe just check the type.