Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: Python-Aprium
-
Component/s: Python Driver
-
Labels:None
Description
There is a error when running setup.py in Python2.6, 3.0
Traceback (most recent call last):
File "setup.py", line 41, in <module>
if sys.version_info.major == 2 and sys.version_info.minor >= 5:
AttributeError: 'tuple' object has no attribute 'major'
Solution:
In Python 2.6 and 3.0, sys.version_info is a tuple and it's elements can only be access by the index.
In the Python 2.7, 3.1 and later version of Python, sys.version_info was add named component attributes and can be use the following forms:
sys.version_info.major
Using the index to access the elements.
Reference:
In Python 2.6:
sys.version_info
A tuple containing the five components of the version number: major, minor, micro, releaselevel, and serial. All values except releaselevel are integers; the release level is 'alpha', 'beta', 'candidate', or 'final'. The version_info value corresponding to the Python version 2.0 is (2, 0, 0, 'final', 0).
In Python 2.7:
sys.version_info
A tuple containing the five components of the version number: major, minor, micro, releaselevel, and serial. All values except releaselevel are integers; the release level is 'alpha', 'beta', 'candidate', or 'final'. The version_info value corresponding to the Python version 2.0 is (2, 0, 0, 'final', 0). The components can also be accessed by name, so sys.version_info[0] is equivalent to sys.version_info.major and so on.
New in version 2.0.
Changed in version 2.7: Added named component attributes