# HG changeset patch # User Jaroslav Hajek # Date 1253272534 -7200 # Node ID e1593574ee97ae6f7ec72fbd392e3d9bb63daa64 # Parent d60165bfc849fa21d7c532ef2416975fd4be2430 fix typo in rev 37 diff -r d60165bfc849 -r e1593574ee97 ChangeLog --- 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 + + * package/pytave.py: Safer check for interactive (mod_wsgi in + Apache!) + 2009-09-18 Jaroslav Hajek * python_to_octave.cc (copy_pyarrobj_to_octarray, diff -r d60165bfc849 -r e1593574ee97 package/pytave.py --- 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