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:
parent
4358e6440a
commit
bc9306fc1b
@ -1729,7 +1729,7 @@ class LoadingSurvex:
|
|||||||
stash_data_issue(parser="survex", message=message, url=None, sb=(path))
|
stash_data_issue(parser="survex", message=message, url=None, sb=(path))
|
||||||
return # skip this survex file and all things *included in it
|
return # skip this survex file and all things *included in it
|
||||||
except:
|
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)
|
||||||
print(message, file=sys.stderr)
|
print(message, file=sys.stderr)
|
||||||
stash_data_issue(parser="survex", message=message, url=None, sb=(path))
|
stash_data_issue(parser="survex", message=message, url=None, sb=(path))
|
||||||
@ -1758,38 +1758,43 @@ class LoadingSurvex:
|
|||||||
"""regenerates the .3d file from the .svx if it is older than the svx file, or older than the software,
|
"""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.
|
or randomly using chaosmonkey() just to keep things ticking over.
|
||||||
"""
|
"""
|
||||||
print(
|
try:
|
||||||
f" - Regenerating stale (or chaos-monkeyed) cavern .log and .3d for '{fullpath}'\n at '{logpath}'\n"
|
|
||||||
)
|
|
||||||
print(
|
|
||||||
f"days svx old: {(svx_t - log_t)/(24*3600):.1f} cav:{(cav_t - log_t)/(24*3600):.1f} log old: { (now - log_t)/(24*3600):.1f}"
|
|
||||||
)
|
|
||||||
|
|
||||||
outputdir = Path(str(f"{fullpath}.svx")).parent
|
|
||||||
sp = subprocess.run(
|
|
||||||
[settings.CAVERN, "--log", f"--output={outputdir}", f"{fullpath}.svx"],
|
|
||||||
capture_output=True,
|
|
||||||
check=False,
|
|
||||||
text=True,
|
|
||||||
)
|
|
||||||
if sp.returncode != 0:
|
|
||||||
message = f" ! Error running {settings.CAVERN}: {fullpath}"
|
|
||||||
url = f"/survexfile{fullpath}.svx".replace(settings.SURVEX_DATA, "")
|
|
||||||
stash_data_issue(parser="xEntrances", message=message, url=url)
|
|
||||||
print(message)
|
|
||||||
print(
|
print(
|
||||||
"stderr:\n\n" + str(sp.stderr) + "\n\n" + str(sp.stdout) + "\n\nreturn code: " + str(sp.returncode)
|
f" - Regenerating stale (or chaos-monkeyed) cavern .log and .3d for '{fullpath}'\n at '{logpath}'\n"
|
||||||
|
)
|
||||||
|
print(
|
||||||
|
f"days svx old: {(svx_t - log_t)/(24*3600):.1f} cav:{(cav_t - log_t)/(24*3600):.1f} log old: { (now - log_t)/(24*3600):.1f}"
|
||||||
)
|
)
|
||||||
self.caverncount += 1
|
|
||||||
|
|
||||||
# should also collect all the .err files too and create a DataIssue for each one which
|
outputdir = Path(str(f"{fullpath}.svx")).parent
|
||||||
# - is nonzero in size AND
|
sp = subprocess.run(
|
||||||
# - has Error greater than 5% anywhere, or some other more serious error
|
[settings.CAVERN, "--log", f"--output={outputdir}", f"{fullpath}.svx"],
|
||||||
|
capture_output=True,
|
||||||
|
check=False,
|
||||||
|
text=True,
|
||||||
|
)
|
||||||
|
if sp.returncode != 0:
|
||||||
|
message = f" ! Error running {settings.CAVERN}: {fullpath}"
|
||||||
|
url = f"/survexfile{fullpath}.svx".replace(str(settings.SURVEX_DATA), "")
|
||||||
|
stash_data_issue(parser="xEntrances", message=message, url=url)
|
||||||
|
print(message)
|
||||||
|
print(
|
||||||
|
"stderr:\n\n" + str(sp.stderr) + "\n\n" + str(sp.stdout) + "\n\nreturn code: " + str(sp.returncode)
|
||||||
|
)
|
||||||
|
self.caverncount += 1
|
||||||
|
|
||||||
errpath = Path(fullpath + ".err")
|
# should also collect all the .err files too and create a DataIssue for each one which
|
||||||
if errpath.is_file():
|
# - is nonzero in size AND
|
||||||
if errpath.stat().st_size == 0:
|
# - has Error greater than 5% anywhere, or some other more serious error
|
||||||
errpath.unlink() # delete empty closure error file
|
|
||||||
|
errpath = Path(fullpath + ".err")
|
||||||
|
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")
|
svxpath = Path(fullpath + ".svx")
|
||||||
logpath = Path(fullpath + ".log")
|
logpath = Path(fullpath + ".log")
|
||||||
@ -1797,7 +1802,7 @@ class LoadingSurvex:
|
|||||||
|
|
||||||
if not svxpath.is_file():
|
if not svxpath.is_file():
|
||||||
message = f' ! BAD survex file "{fullpath}" specified in *include in {calledpath} '
|
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)
|
print(message)
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -1811,7 +1816,7 @@ class LoadingSurvex:
|
|||||||
sp = subprocess.run(["which", f"{settings.CAVERN}"], capture_output=True, check=False, text=True)
|
sp = subprocess.run(["which", f"{settings.CAVERN}"], capture_output=True, check=False, text=True)
|
||||||
if sp.returncode != 0:
|
if sp.returncode != 0:
|
||||||
message = f' ! Error running "which" on {settings.CAVERN}'
|
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(message)
|
||||||
print(
|
print(
|
||||||
"stderr:\n\n" + str(sp.stderr) + "\n\n" + str(sp.stdout) + "\n\nreturn code: " + str(sp.returncode)
|
"stderr:\n\n" + str(sp.stderr) + "\n\n" + str(sp.stdout) + "\n\nreturn code: " + str(sp.returncode)
|
||||||
|
Loading…
Reference in New Issue
Block a user