Browse Source

utils/python_server.sh uses the right module for each python version

Luca Siciliano 12 years ago
parent
commit
a49ba83b64
1 changed files with 10 additions and 1 deletions
  1. 10 1
      utils/servers/python_server.sh

+ 10 - 1
utils/servers/python_server.sh

@@ -1,4 +1,13 @@
 #!/bin/sh
 
 cd `dirname $0`/../../
-python -m SimpleHTTPServer
+
+ret=`python -c 'import sys; print("%i" % (sys.version_info[0]))'`
+if [ $ret -eq 2 ]; then 
+	# Python 2
+    python -m SimpleHTTPServer
+else 
+	# Python 3
+    python -m http.server
+fi
+