Opened 5 years ago

Closed 5 years ago

#8565 closed defect (fixed)

run_tests.py --python3 fails if python < 2.7 is the default python version

Reported by: Desoxy Owned by: atagar
Priority: Very Low Milestone:
Component: Core Tor/Stem Version:
Severity: Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

desoxy@localhost:~/git/stem$ python --version
Python 2.6.6
desoxy@localhost:~/git/stem$ python run_tests.py --python3
Traceback (most recent call last):
  File "run_tests.py", line 428, in <module>
    if CONFIG["argument.python3"] and sys.version_info.major != 3:
AttributeError: 'tuple' object has no attribute 'major'

The reason is simple: sys.version_info only became a named tuple in Python v2.7 and later.[1]

Assuming you want to keep compability with older Python versions, the attached one-line patch fixes this problem.

1: http://docs.python.org/2/library/sys.html?highlight=sys#sys.version_info))

Child Tickets

Attachments (1)

python26-2to3-test-patch.patch (567 bytes) - added by Desoxy 5 years ago.

Download all attachments as: .zip

Change History (2)

Changed 5 years ago by Desoxy

comment:1 Changed 5 years ago by atagar

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.