@@ -77,6 +77,12 @@ def SetPrintLevel(level):
7777 if mode in level .lower ():
7878 printLevel = mode
7979 return
80+ def SetDebugMode (mode ):
81+ '''Set the debug configuration mode on (mode=True) or off (mode=False).
82+ This will provide some additional output that may help with
83+ tracking down problems in the code.
84+ '''
85+ GSASIIpath .SetConfigValue ({'debug' :bool (mode )})
8086
8187def installScriptingShortcut ():
8288 '''Creates a file named G2script in the current Python site-packages directory.
@@ -429,7 +435,7 @@ def import_generic(filename, readerlist, fmthint=None, bank=None,
429435 elif flag :
430436 primaryReaders .append (reader )
431437 if not secondaryReaders and not primaryReaders :
432- raise G2ImportException ("Could not read file: " , filename )
438+ raise G2ImportException (f "Could not read file: { filename } " )
433439
434440 with open (filename , 'r' ):
435441 rd_list = []
@@ -486,7 +492,7 @@ def import_generic(filename, readerlist, fmthint=None, bank=None,
486492 G2fil .G2Print ("{} block # {} read by Reader {}"
487493 .format (filename ,bank ,rd .formatName ))
488494 return rd_list
489- raise G2ImportException ("No reader could read file: " + filename )
495+ raise G2ImportException (f "No reader could read file: { filename } " )
490496
491497
492498def load_iprms (instfile , reader , bank = None ):
@@ -533,8 +539,7 @@ def load_iprms(instfile, reader, bank=None):
533539 elif ibanks == 1 :
534540 reader .instbank = 1
535541 else :
536- raise G2ImportException ("Instrument parameter file has {} banks, select one with instbank param."
537- .format (ibanks ))
542+ raise G2ImportException (f"Instrument parameter file has { ibanks } banks, select one with instbank param." )
538543 reader .powderentry [2 ] = 1
539544 reader .instfile = instfile
540545 reader .instmsg = '{} bank {}' .format (instfile ,reader .instbank )
0 commit comments