Attachment 'anynumpy.py'

Download

   1 # import either NumPy, or numarray, or Numeric
   2 
   3 for name in ('numpy', 'numarray', 'Numeric'):
   4     failed = False
   5     try:
   6          eval(compile('from %s import *' % name, 'eval', 'exec'))
   7 	 if name == 'numpy':
   8 	     pass
   9 	     #from numpy.oldnumeric.compat import *
  10              #Float = float
  11              #UInt8 = uint8
  12     except ImportError:
  13         failed = True
  14     if not failed:
  15         break
  16 else:
  17     import PyQt4.Qt as Qt
  18     if not Qt.QCoreApplication.instance():
  19         a = Qt.QApplication([])
  20     Qt.QMessageBox.critical(
  21         None,
  22         'Numerical Python Extension Required',
  23         'This example requires a Numerical Python Extension, but\n'
  24         'failed to import either NumPy, or numarray, or Numeric.\n'
  25         'NumPy is available at http://sourceforge.net/projects/numpy'
  26         )
  27     raise SystemExit, (
  28         'Failed to import either NumPy, or numarray, or Numeric.\n'
  29         'NumPy is available at http://sourceforge.net/projects/numpy'
  30         )
  31 
  32 # Local Variables: ***
  33 # mode: python ***
  34 # End: ***

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.

You are not allowed to attach a file to this page.