Changeset 1805 for trunk/GSASII.py


Ignore:
Timestamp:
Apr 23, 2015 9:54:49 PM (7 years ago)
Author:
toby
Message:

fix bug on with unused constraints and with chained equivalences; improve diagnostics from constraint errors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r1797 r1805  
    20412041            self._init_Macro()
    20422042        HelpMenu=G2G.MyHelp(self,helpType='Data tree',
    2043             morehelpitems=[#('&Old Tutorials','OldTutorials'), # this will eventually go away
     2043            morehelpitems=[
    20442044                           ('&Tutorials','Tutorials'),
    20452045                           ])
     
    21722172            try:
    21732173                self.StartProject()         #open the file if possible
    2174             except:
    2175                 print 'Error opening file',arg[1]
     2174            except Exception:
     2175                print 'Error opening or reading file',arg[1]
     2176                import traceback
     2177                print traceback.format_exc()
    21762178             
    21772179        self.ImportDir = os.path.normpath(os.getcwd()) # specifies a default path to be used for imports
     
    29532955            self.StartProject()         #open the file if possible
    29542956        except:
    2955             print 'Error opening file ',filename
     2957            print '\nError opening file ',filename
     2958            import traceback
     2959            print traceback.format_exc()
    29562960       
    29572961    def StartProject(self):
     
    29802984            self.PatternTree.SelectItem(Id)
    29812985        self.CheckNotebook()
    2982         os.chdir(self.dirname)           # to get Mac/Linux to change directory!
     2986        if self.dirname: os.chdir(self.dirname)           # to get Mac/Linux to change directory!
    29832987
    29842988    def OnFileClose(self, event):
     
    34693473        self.OnFileSave(event)
    34703474        # check that constraints are OK here
    3471         errmsg, warnmsg = G2stIO.CheckConstraints(self.GSASprojectfile)
     3475        errmsg, warnmsg = G2stIO.ReadCheckConstraints(self.GSASprojectfile)
    34723476        if errmsg:
    3473             print('Error in constraints:\n'+errmsg+
    3474                   '\nRefinement not possible')
    34753477            self.ErrorDialog('Constraint Error',
    3476                              'Error in constraints:\n'+errmsg+
    3477                              '\nRefinement not possible')
     3478                             'Error in constraints. Refinement not possible.'+
     3479                             '\nSee console error message for details.')
    34783480            return
    34793481        if warnmsg:
     
    34813483                  warnmsg+'\nRefinement not possible')
    34823484            self.ErrorDialog('Refinement Flag Error',
    3483                              'Conflict between refinment flag settings and constraints:\n'+
     3485                             'Conflict between refinement flag settings and constraints:\n'+
    34843486                             warnmsg+
    34853487                             '\nRefinement not possible')
     
    35463548        self.OnFileSave(event)
    35473549        # check that constraints are OK here
    3548         errmsg, warnmsg = G2stIO.CheckConstraints(self.GSASprojectfile)
     3550        errmsg, warnmsg = G2stIO.ReadCheckConstraints(self.GSASprojectfile)
    35493551        if errmsg:
    3550             print('Error in constraints:\n'+errmsg+
    3551                   '\nRefinement not possible')
    35523552            self.ErrorDialog('Constraint Error',
    35533553                             'Error in constraints:\n'+errmsg+
Note: See TracChangeset for help on using the changeset viewer.