Changeset 0225a3f in sasview


Ignore:
Timestamp:
Sep 26, 2017 12:38:19 PM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
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, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
36ca21e
Parents:
d5aeaa3
Message:

add -c 'command' option to run.py; fix run.py shebang

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • run.py

    r2ecb0a5 r0225a3f  
     1#!/usr/bin/env python 
    12# -*- coding: utf-8 -*- 
    2 #!/usr/bin/env python 
    33""" 
    44Run sasview in place.  This allows sasview to use the python 
  • src/sas/sasview/sasview.py

    r9e6aeaf r0225a3f  
    1818import logging 
    1919 
    20 reload(sys) 
    21 sys.setdefaultencoding("iso-8859-1") 
     20try: 
     21    reload(sys) 
     22    sys.setdefaultencoding("iso-8859-1") 
     23except NameError: 
     24    # On python 3 sys.setdefaultencoding does nothing, so pass. 
     25    # We know we are in python 3 at this point since reload is no longer in 
     26    # builtins, but instead has been moved to importlib, hence the NameError. 
     27    pass 
    2228 
    2329import sas 
     
    233239            import code 
    234240            code.interact(local={'exit': sys.exit}) 
     241    elif sys.argv[1] == '-c': 
     242        exec(sys.argv[2]) 
    235243    else: 
    236244        thing_to_run = sys.argv[1] 
Note: See TracChangeset for help on using the changeset viewer.