Bläddra i källkod

Modifies the way one supplies data files to use the yaml config file

Caleb Fangmeier 7 år sedan
förälder
incheckning
96aa153634
1 ändrade filer med 5 tillägg och 1 borttagningar
  1. 5 1
      filval/plotter.py

+ 5 - 1
filval/plotter.py

@@ -81,7 +81,8 @@ def decl_plot(fn):
 
 def generate_dashboard(plots, title, output='dashboard.html', template='dashboard.j2', source_file=None):
     from jinja2 import Environment, PackageLoader, select_autoescape
-    from os.path import join
+    from os.path import join, isdir
+    from os import mkdir
     from urllib.parse import quote
 
     env = Environment(
@@ -105,6 +106,9 @@ def generate_dashboard(plots, title, output='dashboard.html', template='dashboar
     else:
         source = "# Not supplied!!"
 
+    if not isdir('output'):
+        mkdir('output')
+
     with open(join('output', output), 'w') as tempout:
         templ = env.get_template(template)
         tempout.write(templ.render(