summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2016-12-09 00:05:43 -0500
committerTodd Leonhardt <todd.leonhardt@gmail.com>2016-12-09 00:05:43 -0500
commit12507cf535bf5fcc4ddfc99df6228c7938090369 (patch)
tree263c46736836447932a06e6edf98537c1980b665
parentc6e1f1e58ce65686329e2163c0da17d84a446f2d (diff)
downloadcmd2-git-12507cf535bf5fcc4ddfc99df6228c7938090369.tar.gz
Loading in a script file now works in Python 3.5
-rw-r--r--.gitignore5
-rwxr-xr-xcmd2.py8
2 files changed, 13 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..43f3b2b5
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+__pycache__
+build
+dist
+cmd2.egg-info
+
diff --git a/cmd2.py b/cmd2.py
index 8098b996..8b94c3e2 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -49,6 +49,14 @@ try:
except NameError:
raw_input = input
+# Python 3 compatability hack due to no built-in file keyword in Python 3
+# Due to two occurences of isinstance(<foo>, file) checking to see if something is of file type
+try:
+ import io
+ file = io.TextIOWrapper
+except ImportError:
+ pass # Python2
+
if sys.version_info[0] == 2:
pyparsing.ParserElement.enablePackrat()