2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-25 08:41:51 +00:00

str() needed with python 3.11.0rc1 & added try/execept

This commit is contained in:
Philip Sargent 2023-02-24 17:21:56 +00:00
parent 4358e6440a
commit bc9306fc1b

View File

@ -1729,7 +1729,7 @@ class LoadingSurvex:
stash_data_issue(parser="survex", message=message, url=None, sb=(path))
return # skip this survex file and all things *included in it
except:
message = f" ! ERROR *include file '{path}' in '{survexblock}' has unexpected error. OMITTED!"
message = f" ! ERROR *include file '{path}' in '{survexblock}' has unexpected error on opening file. OMITTED!"
print(message)
print(message, file=sys.stderr)
stash_data_issue(parser="survex", message=message, url=None, sb=(path))
@ -1758,6 +1758,7 @@ class LoadingSurvex:
"""regenerates the .3d file from the .svx if it is older than the svx file, or older than the software,
or randomly using chaosmonkey() just to keep things ticking over.
"""
try:
print(
f" - Regenerating stale (or chaos-monkeyed) cavern .log and .3d for '{fullpath}'\n at '{logpath}'\n"
)
@ -1774,7 +1775,7 @@ class LoadingSurvex:
)
if sp.returncode != 0:
message = f" ! Error running {settings.CAVERN}: {fullpath}"
url = f"/survexfile{fullpath}.svx".replace(settings.SURVEX_DATA, "")
url = f"/survexfile{fullpath}.svx".replace(str(settings.SURVEX_DATA), "")
stash_data_issue(parser="xEntrances", message=message, url=url)
print(message)
print(
@ -1790,6 +1791,10 @@ class LoadingSurvex:
if errpath.is_file():
if errpath.stat().st_size == 0:
errpath.unlink() # delete empty closure error file
except:
message = f' ! FAIL running cavern on survex file "{fullpath}" specified in *include in {calledpath} '
stash_data_issue(parser="survex", message=message)
print(message)
svxpath = Path(fullpath + ".svx")
logpath = Path(fullpath + ".log")
@ -1797,7 +1802,7 @@ class LoadingSurvex:
if not svxpath.is_file():
message = f' ! BAD survex file "{fullpath}" specified in *include in {calledpath} '
stash_data_issue(parser="entrances", message=message)
stash_data_issue(parser="survex", message=message)
print(message)
return
@ -1811,7 +1816,7 @@ class LoadingSurvex:
sp = subprocess.run(["which", f"{settings.CAVERN}"], capture_output=True, check=False, text=True)
if sp.returncode != 0:
message = f' ! Error running "which" on {settings.CAVERN}'
stash_data_issue(parser="entrances", message=message)
stash_data_issue(parser="survex", message=message)
print(message)
print(
"stderr:\n\n" + str(sp.stderr) + "\n\n" + str(sp.stdout) + "\n\nreturn code: " + str(sp.returncode)