changeset 359:f42f92dc7464

silencing baseexception warnings
author catherine@cordelia
date Mon, 01 Jun 2009 16:23:44 -0400
parents cdd403e73132
children 692ce3ee80d2
files setup.py sqlpython/sqlpyPlus.py
diffstat 2 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/setup.py	Thu May 28 17:37:20 2009 -0400
+++ b/setup.py	Mon Jun 01 16:23:44 2009 -0400
@@ -17,7 +17,7 @@
       url="http://packages.python.org/sqlpython",
       packages=find_packages(),
       include_package_data=True,    
-      install_requires=['pyparsing','cmd2>=0.5.4','cx_Oracle>=5.0.1'
+      install_requires=['pyparsing','cmd2>=0.5.4','cx_Oracle>=5.0.1',
                         'genshi>=0.5','sqlalchemy'],
       keywords = 'client oracle database',
       license = 'MIT',
--- a/sqlpython/sqlpyPlus.py	Thu May 28 17:37:20 2009 -0400
+++ b/sqlpython/sqlpyPlus.py	Mon Jun 01 16:23:44 2009 -0400
@@ -29,6 +29,8 @@
 from metadata import metaqueries
 from plothandler import Plot
 from sqlpython import Parser
+import warnings
+warnings.filterwarnings('ignore', 'BaseException.message', DeprecationWarning)
 try:
     import pylab
 except (RuntimeError, ImportError):
@@ -313,6 +315,14 @@
             return '', '', ''
         return cmd, arg, line
 
+    def perror(self, err, statement=None):
+        try:
+            linenum = statement.parsed.raw[:err.message.offset].count('\n')
+            print statement.parsed.raw.splitlines()[linenum]
+            print '%s^' % (' ' * (err.message.offset + len(self.prompt)))
+        except AttributeError:
+            pass
+        print str(err)
     def dbms_output(self):
         "Dumps contents of Oracle's DBMS_OUTPUT buffer (where PUT_LINE goes)"
         try: