Changeset 2819


Ignore:
Timestamp:
May 4, 2017 9:14:19 AM (5 years ago)
Author:
vondreele
Message:

fix printing of nonascii characters (e.g. "umlaut-o") in file names, etc. in exporters

Location:
trunk/exports
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/exports/G2export_CIF.py

    r2738 r2819  
    21782178    except IOError:
    21792179        dictobj = cif.CifDic(fil)
    2180     if DEBUG: print('loaded '+str(fil))
     2180    if DEBUG: print('loaded '+fil)
    21812181    for item in dictobj.keys():
    21822182        cifdic[item] = {}
     
    21932193        cPickle.dump(cifdic,fp)
    21942194        fp.close()
    2195         if DEBUG: print('wrote '+str(fil))
     2195        if DEBUG: print('wrote '+fil)
    21962196    except:
    2197         print ('Unable to write '+str(fil))
     2197        print ('Unable to write '+fil)
    21982198    return cifdic
    21992199
     
    22162216            try:
    22172217                cifdic.update(cPickle.load(fp))
    2218                 if DEBUG: print('reloaded '+str(fil))
     2218                if DEBUG: print('reloaded '+fil)
    22192219                break
    22202220            finally:
  • trunk/exports/G2export_FIT2D.py

    r2376 r2819  
    7070            self.filename = os.path.join(self.dirname,fileroot + self.extension)
    7171            self.Writer(hist)
    72             print('Histogram '+str(hist)+' written to file '+str(self.fullpath))
     72            print('Histogram '+hist+' written to file '+self.fullpath)
    7373
    7474class ExportPowderQCHI(G2IO.ExportBaseclass):
     
    119119            self.filename = os.path.join(self.dirname,fileroot + self.extension)
    120120            self.Writer(hist)
    121             print('Histogram '+str(hist)+' written to file '+str(self.fullpath))
     121            print('Histogram '+hist+' written to file '+self.fullpath)
  • trunk/exports/G2export_PDB.py

    r1299 r2819  
    134134            General = phasedict['General']
    135135            if General['Type'] != 'macromolecular':
    136                 print 'phase '+str(phasenam)+' not macromolecular, skipping'
     136                print 'phase '+phasenam+' not macromolecular, skipping'
    137137                continue
    138138            i = self.Phases[phasenam]['pId']
     
    197197            self.Write('END')
    198198            self.CloseFile()
    199             print('Phase '+str(phasenam)+' written to PDB file '+str(self.fullpath))
     199            print('Phase '+phasenam+' written to PDB file '+self.fullpath)
    200200
    201201class ExportPhaseCartXYZ(G2IO.ExportBaseclass):
     
    232232            Atoms = phasedict['Atoms']
    233233            if not len(Atoms):
    234                 print('**** ERROR - Phase '+str(phasenam)+' has no atoms! ****')
     234                print('**** ERROR - Phase '+phasenam+' has no atoms! ****')
    235235                continue
    236236            if len(self.phasenam) > 1: # if more than one filename is included, add a phase #
     
    247247                self.Write(fmt.format(atom[ct],*xyz))
    248248            self.CloseFile()
    249             print('Phase '+str(phasenam)+' written to XYZ file '+str(self.fullpath))
     249            print('Phase '+phasenam+' written to XYZ file '+self.fullpath)
    250250   
  • trunk/exports/G2export_csv.py

    r2433 r2819  
    9797
    9898        if mode == 'w':
    99             print('Phase '+str(phasenam)+' written to file '+str(self.fullpath))
     99            print('Phase '+phasenam+' written to file '+self.fullpath)
    100100        self.CloseFile()
    101101   
     
    154154                        line += ","
    155155                self.Write(line)
    156             print('Phase '+str(phasenam)+' written to file '+str(self.fullpath))
     156            print('Phase '+phasenam+' written to file '+self.fullpath)
    157157        self.CloseFile()
    158158
     
    210210            self.filename = os.path.join(self.dirname,fileroot + self.extension)
    211211            self.Writer(hist)
    212             print('Histogram '+str(hist)+' written to file '+str(self.fullpath))
     212            print('Histogram '+hist+' written to file '+self.fullpath)
    213213
    214214class ExportMultiPowderCSV(G2IO.ExportBaseclass):
     
    253253            digitList += [(13,3),]
    254254            csvData.append(histblk['Data'][1])
    255             print('Histogram '+str(hist)+' written to file '+str(self.fullpath))
     255            print('Histogram '+hist+' written to file '+self.fullpath)
    256256        self.OpenFile()
    257257        WriteList(self,headList)
     
    338338                        self.Write(fmt.format(h,k,l,pos,Fobs,Fcalc,phase,mult,s,g,FWHM,Prfo,i))
    339339        self.CloseFile()
    340         print(str(hist)+'reflections written to file '+str(self.fullpath))
     340        print(hist+'reflections written to file '+self.fullpath)
    341341
    342342class ExportSingleCSV(G2IO.ExportBaseclass):
     
    384384                    self.Write(fmt.format(h,k,l,pos,Fobs,Fcalc,phase,mult,i))
    385385        self.CloseFile()
    386         print(str(hist)+' written to file '+str(self.fullname))                       
     386        print(hist+' written to file '+self.fullname)                       
    387387
    388388class ExportStrainCSV(G2IO.ExportBaseclass):
     
    427427                self.Write(fmt2.format(dat[1],dat[0],dat[2]))           
    428428        self.CloseFile()
    429         print(str(hist)+' written to file '+str(self.fullpath))
     429        print(hist+' written to file '+self.fullpath)
  • trunk/exports/G2export_examples.py

    r2136 r2819  
    114114                        vals.append(G2mth.ValEsd(val,sig))
    115115                    self.Write(fmt.format(*vals))
    116             print('Phase '+str(phasenam)+' written to file '+str(self.fullpath))
     116            print('Phase '+phasenam+' written to file '+self.fullpath)
    117117        self.CloseFile()
    118118
     
    164164        hist = self.histnam[0] # there should only be one histogram, in any case take the 1st
    165165        self.Writer(hist)
    166         print(str(hist)+' written to file '+str(self.fullpath))
     166        print(hist+' written to file '+self.fullpath)
    167167       
    168168class ExportPowderReflText(G2IO.ExportBaseclass):
     
    244244                            s,g,FWHM,prfo))
    245245        self.CloseFile()
    246         print(str(hist)+'reflections written to file '+str(self.fullpath))                       
     246        print(hist+'reflections written to file '+self.fullpath)                       
    247247
    248248class ExportSingleText(G2IO.ExportBaseclass):
     
    287287                self.Write(fmt.format(hklfmt.format(h,k,l),dsp,Fobs,sigFobs,Fcalc,phase,twin))
    288288        self.CloseFile()
    289         print(str(hist)+' written to file '+str(self.fullpath))                       
    290 
     289        print(hist+' written to file '+self.fullpath)                       
     290
  • trunk/exports/G2export_image.py

    r1261 r2819  
    2020GSASIIpath.SetVersionNumber("$Revision$")
    2121import GSASIIIO as G2IO
    22 import GSASIImath as G2mth
    2322
    2423class ExportImagePNG(G2IO.ExportBaseclass):
     
    5352            Comments,Data,Npix,Image = G2IO.GetImageData(self.G2frame,imgFile)
    5453            scipy.misc.imsave(filename,Image)
    55             print('Image '+str(imgFile)+' written to file '+str(filename))
     54            print('Image '+imgFile+' written to file '+filename)
    5655           
  • trunk/exports/G2export_map.py

    r2779 r2819  
    5959            rho = phasedict['General']['Map'].get('rho',[])
    6060            if not len(rho):
    61                 print "There is no map for phase "+str(phasenam)
     61                print "There is no map for phase "+phasenam
    6262                continue
    6363            if len(self.phasenam) > 1: # if more than one filename is written, add a phase # -- not in use yet
     
    118118           
    119119            if not len(rho):
    120                 print "There is no map for phase "+str(phasenam)
     120                print "There is no map for phase "+phasenam
    121121                continue
    122122            if len(self.phasenam) > 1: # if more than one filename is written, add a phase # -- not in use yet
  • trunk/exports/G2export_pwdr.py

    r2152 r2819  
    5959        self.Write(('INS  1PRCF12%15.6e%15.6e%15.6e%15.6e   ')%(Inst['X'][1],Inst['Y'][1],Inst['SH/L'][1]/2.,Inst['SH/L'][1]/2.))
    6060        self.CloseFile()
    61         print('Parameters from '+str(hist)+' written to file '+str(prmname))
     61        print('Parameters from '+hist+' written to file '+prmname)
    6262        return prmname
    6363
     
    104104            prmname = self.WriteInstFile(hist,histblk['Instrument Parameters'][0])
    105105            self.Writer(hist,prmname=prmname)
    106             print('Histogram '+str(hist)+' written to file '+str(self.fullpath))
     106            print('Histogram '+hist+' written to file '+self.fullpath)
    107107
    108108class ExportPowderXYE(G2IO.ExportBaseclass):
     
    156156            self.filename = os.path.join(self.dirname,fileroot + self.extension)
    157157            self.Writer(hist)
    158             print('Histogram '+str(hist)+' written to file '+str(self.fullpath))
     158            print('Histogram '+hist+' written to file '+self.fullpath)
  • trunk/exports/G2export_shelx.py

    r1618 r2819  
    121121            self.Write('END')
    122122            self.CloseFile()
    123             print('Phase '+str(phasenam)+' written to file '+str(self.fullpath))
     123            print('Phase '+phasenam+' written to file '+self.fullpath)
Note: See TracChangeset for help on using the changeset viewer.