opengridcc / opengrid-dev

Open source building monitoring, analysis and control
Apache License 2.0
26 stars 21 forks source link

Q&A Getting started #118

Open rubenbaetens opened 8 years ago

rubenbaetens commented 8 years ago

I'll use this issue to ask a bunch of question while trying to get used on the code.

rubenbaetens commented 8 years ago

i'm trying to make CarpetPlot.ipynb work but

DEV = c.get('env', 'type') == 'dev'

pops up the error

C:\Python27\lib\ConfigParser.pyc in get(self, section, option, raw, vars)
    605         except KeyError:
    606             if section != DEFAULTSECT:
--> 607                 raise NoSectionError(section)
    608         # Update with the entry specific variables
    609         vardict = {}

NoSectionError: No section: 'env'
saroele commented 8 years ago

You need to have a section [env] in your opengrid.cfg file. You can copy the section from the opengrid.cfg.example :

[env]
# type can be dev or prod.  
# Use this in your scripts to avoid execution of detailed analysis for jobs on the server
type: dev 
# plots can be inline (default) or qt.  
# Use qt if you want all plots to be rendered in a separate window.
# This can be useful for zooming or panning.
plots: inline

We have had similar issues previously: specifically when we add sections to the opengrid.cfg file and existing developers don't have these sections in their config file. Maybe we should have more defaults or more explicit error messages.

rubenbaetens commented 8 years ago

I suggest to set by default env = dev in opengrid.cfg en force the user to change it on the server. As there will be many dev and online one prod.

saroele commented 8 years ago

We can't set a default in the opengrid.cfg file: this file is not even in the repo. But luckily @wouterh is a foreseeing man: in config.py, there is a method to set defaults. With commit d6b1b24 I have added defaults for the section env. This should do the trick, let me know if not.