Changeset 517f3d4 in sasview
- Timestamp:
- Mar 2, 2015 9:36:57 AM (10 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- f89fa84
- Parents:
- 18d58a6e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasview/sasview.py
rcaf3baa6 r517f3d4 10 10 ################################################################################ 11 11 import os 12 import sys 12 13 import logging 13 14 from shutil import copy … … 17 18 'sasview.log')) 18 19 19 # Allow the dynamic selection of wxPython via an evironment variable, when devs 20 class StreamToLogger(object): 21 """ 22 File-like stream object that redirects writes to a logger instance. 23 """ 24 def __init__(self, logger, log_level=logging.INFO): 25 self.logger = logger 26 self.log_level = log_level 27 self.linebuf = '' 28 29 def write(self, buf): 30 # Write the message to stdout so we can see it when running interactively 31 sys.stdout.write(buf) 32 for line in buf.rstrip().splitlines(): 33 self.logger.log(self.log_level, line.rstrip()) 34 35 stderr_logger = logging.getLogger('STDERR') 36 sl = StreamToLogger(stderr_logger, logging.ERROR) 37 sys.stderr = sl 38 39 # Log the python version 40 logging.info("Python: %s" % sys.version) 41 42 # Allow the dynamic selection of wxPython via an environment variable, when devs 20 43 # who have multiple versions of the module installed want to pick between them. 21 44 # This variable does not have to be set of course, and through normal usage will … … 35 58 36 59 import wx 37 import sys 60 try: 61 logging.info("Wx version: %s" % wx.__version__) 62 except: 63 logging.error("Wx version: error reading version") 64 38 65 # The below will make sure that sasview application uses the matplotlib font 39 66 # bundled with sasview.
Note: See TracChangeset
for help on using the changeset viewer.