Changeset 3136 for trunk/GSASIIscriptable.py
- Timestamp:
- Oct 23, 2017 11:39:16 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIscriptable.py
r3130 r3136 459 459 print(u'**** ERROR: '+reader+u' is not a scriptable reader') 460 460 return None 461 fl = open(filename,'rb')462 461 rdlist = [] 463 if rd.ContentsValidator(fl): 464 fl.seek(0) 462 if rd.ContentsValidator(filename): 465 463 repeat = True 466 464 rdbuffer = {} # create temporary storage for file reader … … 470 468 repeat = False 471 469 rd.objname = ospath.basename(filename) 472 flag = rd.Reader(filename, fl,None,buffer=rdbuffer,blocknum=block,)470 flag = rd.Reader(filename,None,buffer=rdbuffer,blocknum=block,) 473 471 if flag: 474 472 rdlist.append(copy.deepcopy(rd)) # save the result before it is written over … … 617 615 if atom[ct] in generalData['Isotope']: 618 616 if generalData['Isotope'][atom[ct]] not in generalData['Isotopes'][atom[ct]]: 619 isotope = generalData['Isotopes'][atom[ct]].keys()[-1]617 isotope = list(generalData['Isotopes'][atom[ct]].keys())[-1] 620 618 generalData['Isotope'][atom[ct]] = isotope 621 619 generalData['AtomMass'].append(Info['Isotopes'][generalData['Isotope'][atom[ct]]]['Mass']) … … 623 621 generalData['Isotope'][atom[ct]] = 'Nat. Abund.' 624 622 if 'Nat. Abund.' not in generalData['Isotopes'][atom[ct]]: 625 isotope = generalData['Isotopes'][atom[ct]].keys()[-1]623 isotope = list(generalData['Isotopes'][atom[ct]].keys())[-1] 626 624 generalData['Isotope'][atom[ct]] = isotope 627 625 generalData['AtomMass'].append(Info['Mass']) … … 725 723 rd.ReInitialize() 726 724 # Rewind file 727 fp.seek(0)728 725 rd.errors = "" 729 if not rd.ContentsValidator(f p):726 if not rd.ContentsValidator(filename): 730 727 # Report error 731 728 pass … … 737 734 block = 0 738 735 rdbuffer = {} 739 fp.seek(0)740 736 repeat = True 741 737 while repeat: … … 744 740 rd.objname = os.path.basename(filename) 745 741 try: 746 flag = rd.Reader(filename, fp,buffer=rdbuffer, blocknum=block)742 flag = rd.Reader(filename,buffer=rdbuffer, blocknum=block) 747 743 except: 748 744 flag = False … … 823 819 valuesdict = {'wtFactor': 1.0, 824 820 'Dummy': False, 825 'ranId': ran.randint(0, sys.max int),821 'ranId': ran.randint(0, sys.maxsize), 826 822 'Offset': [0.0, 0.0], 'delOffset': 0.02*Ymax, 827 823 'refOffset': -0.1*Ymax, 'refDelt': 0.1*Ymax, … … 897 893 elif isinstance(from_, list) and isinstance(into, list): 898 894 if len(from_) == len(into): 899 for i in xrange(len(from_)):895 for i in range(len(from_)): 900 896 both_dicts = (isinstance(from_[i], dict) 901 897 and isinstance(into[i], dict))
Note: See TracChangeset
for help on using the changeset viewer.