Py2 vs. Py3 incompatibility: TypeError
See original GitHub issueSituation
I’m confused by the statement in the Readme that seems to say 2.10.0 does still support Python 2.7. That’s not what I’m seeing. I have a project that uses this package and runs in Py2, and as soon as it started using the 2.10 release, I started getting errors like this which look to me like what you’d get from a Py2 vs. Py3 incompatibility:
TypeError("Expected str or VersionInfo instance, but got <type 'unicode'>"
When I pin the dependency to <2.10
, the error goes away.
_Originally posted by @eli-darkly in https://github.com/python-semver/python-semver/issues/161#issuecomment-654455352_
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (13 by maintainers)
Top Results From Across the Web
The key differences between Python 2.7.x and Python 3.x with ...
Comparing unorderable types #. Another nice change in Python 3 is that a TypeError is raised as warning if we try to compare...
Read more >Exceptions - The Conservative Python 3 Porting Guide
ExceptionType can be a tuple, as in, for example, except (TypeError, ValueError): .
Read more >Common migration problems — Supporting Python 3
Under Python 2 the bytes literal and bytes type are just aliases for str so the objects will not behave exactly the same...
Read more >1 - Stack Overflow
with works fine with Python 3.2 but not with 2.6. Then based on this topic: TypeError: super() takes at least 1 argument (0...
Read more >Standard library incompatibilities - Python-Future
Python 3:: >>> array.array(b'b') TypeError: must be a unicode character, not bytes ... You can use the following code on both Python 3...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks Eli! Actually I found an example:
This is a bug, of course, and shouldn’t happen.
Thanks @gsakkis for your ideas. 👍
That was also my thought at first. However, I think it would make sense to have this fix in semver2 too.
I was thinking about six, but I would like to avoid introducing another dependency. Especially if this development line (semver2) will be deprecated soon and we will switch to semver3.
The parts that are coming from six are really very small. All in all it’s ~23 lines of code. It’s probably easy to remove them once we release semver3.