bunch icon indicating copy to clipboard operation
bunch copied to clipboard

platform.version() not suitable for determining if using python 3

Open scott-martin opened this issue 10 years ago • 4 comments

In the file python3_compat.py this line:

_IS_PYTHON_3 = (platform.version() >= '3')

is not a sufficient method for determing if python 3 is being used. For example on my machine this returns #86-Ubuntu SMP Mon May 4 04:32:59 UTC 2015 and I'm running python 3.4.

Ideally we should use something like 2to3, but we might be able to use sys.version.

scott-martin avatar May 20 '15 12:05 scott-martin

Maybe it should be using platform.python_version() ?

theho avatar May 26 '15 22:05 theho

Actually, should be using:

import sys if sys.version_info >= (3, 0):

theho avatar May 26 '15 22:05 theho

Six is doing this way

PY3 = sys.version_info[0] == 3
PY2 = sys.version_info[0] == 2 

if PY3:
    ...
else:
    ...

https://github.com/kelp404/six/blob/master/six.py

femtotrader avatar Oct 02 '15 18:10 femtotrader

https://github.com/dsc/bunch/pull/40 Please fix it.

shizacat avatar Aug 07 '17 13:08 shizacat