diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2016-12-11 12:27:45 -0500 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2016-12-11 12:27:45 -0500 |
commit | 43b1818dd2976d4a2f160fc8ebf2d637c23b7d04 (patch) | |
tree | bcb9edc9a22aa1d4458ec1e0ec6411f7cd54bc46 /cmd2.py | |
parent | e9a15b67970fa030d43089c4dc38f22dd89f0ba7 (diff) | |
download | cmd2-git-43b1818dd2976d4a2f160fc8ebf2d637c23b7d04.tar.gz |
Switched to a safer way of dealing with the fact that Python 3 removed the built-in file() function.
Diffstat (limited to 'cmd2.py')
-rwxr-xr-x | cmd2.py | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -42,7 +42,6 @@ from code import InteractiveConsole from optparse import make_option import pyparsing -import six # next(it) gets next item of iterator it. This is a replacement for calling it.next() in Python 2 and next(it) in Py3 from six import next @@ -62,11 +61,10 @@ from six.moves.urllib.request import urlopen # Python 3 compatability hack due to no built-in file keyword in Python 3 # Due to one occurence of isinstance(<foo>, file) checking to see if something is of file type try: + file +except NameError: import io - file = io.TextIOWrapper -except ImportError: - pass # Python2 __version__ = '0.7.0' |