changeset 80:e1593574ee97

fix typo in rev 37
author Jaroslav Hajek <highegg@gmail.com>
date Fri, 18 Sep 2009 13:15:34 +0200
parents d60165bfc849
children 2e8b52a5e1b1 8ee00dc40ae5
files ChangeLog package/pytave.py
diffstat 2 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Sep 18 10:31:15 2009 +0200
+++ b/ChangeLog	Fri Sep 18 13:15:34 2009 +0200
@@ -1,3 +1,8 @@
+2009-09-18  Jaroslav Hajek  <highegg@gmail.com>
+
+	* package/pytave.py: Safer check for interactive (mod_wsgi in
+	Apache!)
+	
 2009-09-18  Jaroslav Hajek  <highegg@gmail.com>
 	
 	* python_to_octave.cc (copy_pyarrobj_to_octarray,
--- a/package/pytave.py	Fri Sep 18 10:31:15 2009 +0200
+++ b/package/pytave.py	Fri Sep 18 13:15:34 2009 +0200
@@ -26,7 +26,13 @@
 import sys
 
 arg0 = sys.argv[0]
-interactive = sys.stdin.isatty() and (arg0 == '' or arg0 == '-')
+# Some web application packages, such as mod_wsgi for Apache,
+# completely restrict access to stdin, including an isatty() query.
+# Hence, if an error occurs, we'll stay safe.
+try:
+    interactive = sys.stdin.isatty() and (arg0 == '' or arg0 == '-')
+except IOError:
+    interactive = False
 
 _pytave.init(interactive)
 (OctaveError, ValueConvertError, ObjectConvertError, ParseError, \
@@ -190,7 +196,7 @@
     def get_typecode(array):
 	"""gets the typecode from both Numeric and NumPy array"""
 	try:
-	    tc = array.typecode
+	    tc = array.typecode()
 	except:
 	    tc = array.dtype.char
 	return tc