From 20809e91f605109fb0bbda562879614059e8c107 Mon Sep 17 00:00:00 2001 From: Gereon Kremer Date: Sat, 14 Apr 2018 18:10:46 +0200 Subject: [PATCH 1/2] Decouple imports to fix error in python3. In python3 both the try case and the except case fails: - io must be used instead of cStringIO - filterfalse must be used instead of ifilterfalse By decoupling these imports into separate try-excepts, this gets more robust and should work in more cases. Also make io the default as it should work for all python >=2.6. --- rtkit/parser.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rtkit/parser.py b/rtkit/parser.py index 7f48dec..db08770 100644 --- a/rtkit/parser.py +++ b/rtkit/parser.py @@ -1,9 +1,11 @@ try: from itertools import filterfalse as ifilterfalse - from cStringIO import StringIO except ImportError: from itertools import ifilterfalse +try: from io import StringIO +except ImportError: + from cStringIO import StringIO import re from rtkit import comment From 7be8525b9540b17cab78fd33b421bc6518e9a017 Mon Sep 17 00:00:00 2001 From: nafur Date: Sat, 14 Apr 2018 18:18:39 +0200 Subject: [PATCH 2/2] Adding python3 to travis tests. --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index 77b07c8..b11b39c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,11 @@ language: python python: - "2.6" - "2.7" + - "3.3" + - "3.4" + - "3.5" + - "3.6" + - "3.7" install: - pip install -r requirements.txt before_script: