Skip to content

Commit 5c084c5

Browse files
committed
work on binary file creeation overwrite error
1 parent df11a60 commit 5c084c5

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

GSASII/GSASIIpath.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -909,11 +909,16 @@ def InstallGitBinary(tarURL, instDir, nameByVersion=False, verbose=True):
909909
print(f'skipping file {f.name} -- how did this happen?')
910910
continue
911911
newfil = os.path.normpath(os.path.join(install2dir,f.name))
912-
tarobj.extract(f, path=install2dir, set_attrs=False)
912+
if os.path.exists(newfil):
913+
os.chmod(newfil,0o666)
914+
try:
915+
tarobj.extract(f, path=install2dir, set_attrs=False)
916+
if verbose: print(f'Created GSAS-II binary file {os.path.split(newfil)[1]}')
917+
except:
918+
print(f'Failed to create GSAS-II binary file {os.path.split(newfil)[1]}')
913919
# set file mode and mod/access times (but not ownership)
914920
os.chmod(newfil,f.mode)
915921
os.utime(newfil,(f.mtime,f.mtime))
916-
if verbose: print(f'Created GSAS-II binary file {os.path.split(newfil)[1]}')
917922
if verbose: print(f'Binary files created in {os.path.split(newfil)[0]}')
918923

919924
finally:
@@ -1385,7 +1390,10 @@ def XferConfigIni():
13851390
if not os.path.exists(cfgfile):
13861391
print(f'N.B. Configuration file {cfgfile} does not exist')
13871392
# patch 2/7/25: transform GSAS-II config.py contents to config.ini
1388-
XferConfigIni()
1393+
try:
1394+
XferConfigIni()
1395+
except:
1396+
print('transfer of config.py failed')
13891397
try:
13901398
from . import config_example
13911399
except ImportError:

0 commit comments

Comments
 (0)