Skip to content
Permalink
Browse files

observer: create outputdir if it doesn't exist

Observers get initialised at config parse time, before Overviewer
creates the outputdir. So we can just tell them to create the
outputdir if it doesn't already exist to avoid an awkward error
on the initial render.

Fixes #1657.
  • Loading branch information...
CounterPillow committed Oct 27, 2019
1 parent a688c7b commit 3d31347e9beeaff3a447cee68531bfb6114b7d77
Showing with 3 additions and 4 deletions.
  1. +3 −4 overviewer_core/observer.py
@@ -256,11 +256,10 @@ def __init__(self, outputdir, minrefresh=5, messages=False):
raise Exception("JSObserver: messages parameter must be a "
"dictionary with three entries: totalTiles, "
"renderCompleted and renderProgress")
# On the initial render, the outputdir hasn't been created until after the observer is
# initialised, so let's just do it here if necessary.
if not os.path.exists(outputdir):
raise Exception("JSObserver: Output directory specified (%s) "
"doesn't appear to exist. This should be the "
"same as the Overviewer output directory"
% outputdir)
os.mkdir(outputdir)

self.logfile = open(os.path.join(outputdir, "progress.json"), "wb+", 0)
self.json["message"] = "Render starting..."

0 comments on commit 3d31347

Please sign in to comment.
You can’t perform that action at this time.