Repository: architecture-building-systems/cityenergyanalyst
Issue: Cannot import input files to create scenario

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to cea dashboard
2. Click on create scenario
3. Click import input files
4. selected any `zone.shp` and then click create
5. see error
```
City Energy Analyst version 3.30.0
[2022-04-26 22:19:57.202] [info]  (main) Running `cea create-new-scenario` with the following parameters:
- create-new-scenario:project = cea-new-project
  (default: cea-new-project)
- create-new-scenario:scenario = baseline
  (default: baseline)
- create-new-scenario:output-path = C:\\Users\\shsieh\\Documents\\CityEnergyAnalyst
  (default: C:\\Users\\shsieh\\Documents)
- create-new-scenario:zone = C:\\Users\\shsieh\\Documents\\CEA_Projects\\test_gui_pr\\sss\\inputs\\building-geometry\\zone.shp
  (default: C:\\Users\\shsieh\\AppData\\Local\\Temp\\tmplancz9ug\\temp/inputs/building-geometry/zone.shp)
- create-new-scenario:terrain = 
  (default: C:\\Users\\shsieh\\AppData\\Local\\Temp\\tmplancz9ug\\temp/inputs/topography/terrain.tif)
- create-new-scenario:streets = 
  (default: C:\\Users\\shsieh\\AppData\\Local\\Temp\\tmplancz9ug\\temp/inputs/networks/streets.shp)
- create-new-scenario:surroundings = 
  (default: )
- create-new-scenario:typology = 
  (default: )
[2022-04-26 22:19:57.203] [info]  (main) Running create-new-scenario for project = cea-new-project
Running create-new-scenario with scenario = baseline
Running create-new-scenario with typology = 
Running create-new-scenario with zone = C:\\Users\\shsieh\\Documents\\CEA_Projects\\test_gui_pr\\sss\\inputs\\building-geometry\\zone.shp
Running create-new-scenario with terrain = 
Running create-new-scenario with output-path = C:\\Users\\shsieh\\Documents\\CityEnergyAnalyst
[2022-04-26 22:19:57.338] [error] (main) C:\\Users\\shsieh\\Documents\\CityEnergyAnalyst\\Dependencies\\Python\\lib\\site-packages\\geopandas\\io\\file.py:362: FutureWarning: pandas.Int64Index is deprecated and will be removed from pandas in a future version. Use pandas.Index with the appropriate dtype instead.
  pd.Int64Index,
[2022-04-26 22:19:57.365] [info]  (main) there is no terrain file, run pour datamanagement tools later on for this please
there is no surroundings file, run pour datamanagement tools later on for this please
there is no streets file, run pour datamanagement tools later on for this please
there is no typology file, we proceed to create it based on the geometry of your zone
[2022-04-26 22:19:57.443] [info]  (main) New project/scenario created in: C:\\Users\\shsieh\\Documents\\CityEnergyAnalyst\\cea-new-project\\baseline

---------------------------------------
Script completed. Execution time: 0.24s
[2022-04-26 22:19:57.453] [error] (main) [2022-04-26 22:19:57,452] ERROR in app: Exception on /api/project/scenario/ [POST]
Traceback (most recent call last):
  File "C:\\Users\\shsieh\\Documents\\CityEnergyAnalyst\\Dependencies\\Python\\lib\\site-packages\\flask\\app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\\Users\\shsieh\\Documents\\CityEnergyAnalyst\\Dependencies\\Python\\lib\\site-packages\\flask\\app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "C:\\Users\\shsieh\\Documents\\CityEnergyAnalyst\\Dependencies\\Python\\lib\\site-packages\\flask_restplus\\api.py", line 325, in wrapper
    resp = resource(*args, **kwargs)
  File "C:\\Users\\shsieh\\Documents\\CityEnergyAnalyst\\Dependencies\\Python\\lib\\site-packages\\flask\\views.py", line 89, in view
    return self.dispatch_request(*args, **kwargs)
  File "C:\\Users\\shsieh\\Documents\\CityEnergyAnalyst\\Dependencies\\Python\\lib\\site-packages\\flask_restplus\\resource.py", line 44, in dispatch_request
    resp = meth(*args, **kwargs)
  File "c:\\users\\shsieh\\documents\\cityenergyanalyst\\cityenergyanalyst\\cea\\interfaces\\dashboard\\api\\project.py", line 186, in post
    print(f"Moving from {config.scenario} to {new_scenario_path}")
  File "c:\\users\\shsieh\\documents\\cityenergyanalyst\\cityenergyanalyst\\cea\\config.py", line 54, in __getattr__
    return getattr(self.sections['general'], cid)
  File "c:\\users\\shsieh\\documents\\cityenergyanalyst\\cityenergyanalyst\\cea\\config.py", line 285, in __getattr__
    raise AttributeError(
AttributeError: Parameter not configured to work with this script: {general:scenario}
[2022-04-26 22:19:57.454] [error] (renderer) {
  data: {
    message: 'Parameter not configured to work with this script: {general:scenario}',
    trace: 'Traceback (most recent call last):\\n' +
      '  File "C:\\\\Users\\\\shsieh\\\\Documents\\\\CityEnergyAnalyst\\\\Dependencies\\\\Python\\\\lib\\\\site-packages\\\\flask\\\\app.py", line 1950, in full_dispatch_request\\n' +
      '    rv = self.dispatch_request()\\n' +
      '  File "C:\\\\Users\\\\shsieh\\\\Documents\\\\CityEnergyAnalyst\\\\Dependencies\\\\Python\\\\lib\\\\site-packages\\\\flask\\\\app.py", line 1936, in dispatch_request\\n' +
      '    return self.view_functions[rule.endpoint](**req.view_args)\\n' +
      '  File "C:\\\\Users\\\\shsieh\\\\Documents\\\\CityEnergyAnalyst\\\\Dependencies\\\\Python\\\\lib\\\\site-packages\\\\flask_restplus\\\\api.py", line 325, in wrapper\\n' +
      '    resp = resource(*args, **kwargs)\\n' +
      '  File "C:\\\\Users\\\\shsieh\\\\Documents\\\\CityEnergyAnalyst\\\\Dependencies\\\\Python\\\\lib\\\\site-packages\\\\flask\\\\views.py", line 89, in view\\n' +
      '    return self.dispatch_request(*args, **kwargs)\\n' +
      '  File "C:\\\\Users\\\\shsieh\\\\Documents\\\\CityEnergyAnalyst\\\\Dependencies\\\\Python\\\\lib\\\\site-packages\\\\flask_restplus\\\\resource.py", line 44, in dispatch_request\\n' +
      '    resp = meth(*args, **kwargs)\\n' +
      '  File "c:\\\\users\\\\shsieh\\\\documents\\\\cityenergyanalyst\\\\cityenergyanalyst\\\\cea\\\\interfaces\\\\dashboard\\\\api\\\\project.py", line 186, in post\\n' +
      '    print(f"Moving from {config.scenario} to {new_scenario_path}")\\n' +
      '  File "c:\\\\users\\\\shsieh\\\\documents\\\\cityenergyanalyst\\\\cityenergyanalyst\\\\cea\\\\config.py", line 54, in __getattr__\\n' +
      "    return getattr(self.sections['general'], cid)\\n" +
      '  File "c:\\\\users\\\\shsieh\\\\documents\\\\cityenergyanalyst\\\\cityenergyanalyst\\\\cea\\\\config.py", line 285, in __getattr__\\n' +
      '    raise AttributeError(\\n' +
      'AttributeError: Parameter not configured to work with this script: {general:scenario}\\n'
  },
  status: 500,
  statusText: 'INTERNAL SERVER ERROR',
  headers: {
    'access-control-allow-origin': '*',
    'content-length': '1723',
    'content-type': 'application/json',
    date: 'Tue, 26 Apr 2022 20:19:57 GMT'
  },
  config: {
    transitional: {
      silentJSONParsing: true,
      forcedJSONParsing: true,
      clarifyTimeoutError: false
    },
    adapter: '[function] function(t){return new Promise((function(n,e){var d,h=t.data,f=t.headers,g=t.responseType;function m(){t.cancelToken&&t.cancelToken.unsubscribe(d),t.signal&&t.signal.removeEventListener("abort",d)}r.isFormData(h)&&delete f["Content-Type"];var b=new XMLHttpRequest;if(t.auth){var v=t.auth.username||"",y=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";f.Authorization="Basic "+btoa(v+":"+y)}var E=s(t.baseURL,t.url);function x(){if(b){var r="getAllResponseHeaders"in b?l(b.getAllResponseHeaders()):null,i={data:g&&"text"!==g&&"json"!==g?b.response:b.responseText,status:b.status,statusText:b.statusText,headers:r,config:t,request:b};o((function(t){n(t),m()}),(function(t){e(t),m()}),i),b=null}}if(b.open(t.method.toUpperCase(),a(E,t.params,t.paramsSerializer),!0),b.timeout=t.timeout,"onloadend"in b?b.onloadend=x:b.onreadystatechange=function(){b&&4===b.readyState&&(0!==b.status||b.responseURL&&0===b.responseURL.indexOf("file:"))&&setTimeout(x)},b.onabort=function(){b&&(e(u("Request aborted",t,"ECONNABORTED",b)),b=null)},b.onerror=function(){e(u("Network Error",t,null,b)),b=null},b.ontimeout=function(){var n=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",r=t.transitional||A;t.timeoutErrorMessage&&(n=t.timeoutErrorMessage),e(u(n,t,r.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",b)),b=null},r.isStandardBrowserEnv()){var C=(t.withCredentials||c(E))&&t.xsrfCookieName?i.read(t.xsrfCookieName):void 0;C&&(f[t.xsrfHeaderName]=C)}"setRequestHeader"in b&&r.forEach(f,(function(t,n){void 0===h&&"content-type"===n.toLowerCase()?delete f[n]:b.setRequestHeader(n,t)})),r.isUndefined(t.withCredentials)||(b.withCredentials=!!t.withCredentials),g&&"json"!==g&&(b.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&b.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&b.upload&&b.upload.addEventListener("progress",t.onUploadProgress),(t.cancelToken||t.signal)&&(d=function(t){b&&(e(!t||t&&t.type?new p("canceled"):t),b.abort(),b=null)},t.cancelToken&&t.cancelToken.subscribe(d),t.signal&&(t.signal.aborted?d():t.signal.addEventListener("abort",d))),h||(h=null),b.send(h)}))}',
    transformRequest: [
      '[function] function(t,n){return o(n,"Accept"),o(n,"Content-Type"),r.isFormData(t)||r.isArrayBuffer(t)||r.isBuffer(t)||r.isStream(t)||r.isFile(t)||r.isBlob(t)?t:r.isArrayBufferView(t)?t.buffer:r.isURLSearchParams(t)?(l(n,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):r.isObject(t)||n&&"application/json"===n["Content-Type"]?(l(n,"application/json"),function(t,n,e){if(r.isString(t))try{return(0,JSON.parse)(t),r.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(0,JSON.stringify)(t)}(t)):t}'
    ],
    transformResponse: [
      '[function] function(t){var n=this.transitional||u.transitional,e=n&&n.silentJSONParsing,o=n&&n.forcedJSONParsing,a=!e&&"json"===this.responseType;if(a||o&&r.isString(t)&&t.length)try{return JSON.parse(t)}catch(t){if(a){if("SyntaxError"===t.name)throw i(t,this,"E_JSON_PARSE");throw t}}return t}'
    ],
    timeout: 0,
    xsrfCookieName: 'XSRF-TOKEN',
    xsrfHeaderName: 'X-XSRF-TOKEN',
    maxContentLength: -1,
    maxBodyLength: -1,
    validateStatus: '[function] function(t){return t>=200&&t<300}',
    headers: {
      Accept: 'application/json, text/plain, */*',
      'Content-Type': 'application/json'
    },
    method: 'post',
    url: 'http://127.0.0.1:5050/api/project/scenario/',
    data: '{"project":"C:\\\\\\\\Users\\\\\\\\shsieh\\\\\\\\Documents\\\\\\\\CEA_Projects\\\\\\\\test-import-zone","input_data":"import","tools":["zone","weather","surroundings","streets","terrain"],"latlong":{"lat":0,"long":0},"fields":["zone","typology"],"scenario_name":"test","databases_path":"c:\\\\\\\\users\\\\\\\\shsieh\\\\\\\\documents\\\\\\\\cityenergyanalyst\\\\\\\\cityenergyanalyst\\\\\\\\cea\\\\\\\\databases\\\\\\\\CH","location":"","geojson":null,"files":{"zone":"C:\\\\\\\\Users\\\\\\\\shsieh\\\\\\\\Documents\\\\\\\\CEA_Projects\\\\\\\\test_gui_pr\\\\\\\\sss\\\\\\\\inputs\\\\\\\\building-geometry\\\\\\\\zone.shp","typology":""}}'
  },
  request: {}
}
```

**Hardware (please complete the following information):**
 - OS and version: Windows 10
 - v3.29.0


Changed files:
cea/api.py, cea/config.py, cea/interfaces/dashboard/api/project.py

diff --git a/cea/api.py b/cea/api.py
index d51d00115..3c0534f61 100644
--- a/cea/api.py
+++ b/cea/api.py
@@ -24,17 +24,18 @@ def register_scripts():
                 config = cea.config.Configuration()
 
             option_list = cea_script.parameters
-            config.restrict_to(option_list)
-            for section, parameter in config.matching_parameters(option_list):
-                if parameter.py_name in kwargs:
-                    parameter.set(kwargs[parameter.py_name])
-            cea_script.print_script_configuration(config)
-            if list(cea_script.missing_input_files(config)):
-                cea_script.print_missing_input_files(config)
-                raise cea.MissingInputDataException()
-            t0 = datetime.datetime.now()
-            # run the script
-            script_module.main(config)
+
+            with config.temp_restrictions(option_list):
+                for section, parameter in config.matching_parameters(option_list):
+                    if parameter.py_name in kwargs:
+                        parameter.set(kwargs[parameter.py_name])
+                cea_script.print_script_configuration(config)
+                if list(cea_script.missing_input_files(config)):
+                    cea_script.print_missing_input_files(config)
+                    raise cea.MissingInputDataException()
+                t0 = datetime.datetime.now()
+                # run the script
+                script_module.main(config)
 
             # print success message
             msg = "Script completed. Execution time: %.2fs" % (datetime.datetime.now() - t0).total_seconds()
diff --git a/cea/config.py b/cea/config.py
index f87506146..b24ca2638 100644
--- a/cea/config.py
+++ b/cea/config.py
@@ -113,6 +113,32 @@ class Configuration(object):
             self.restricted_to.append('general:project')
             self.restricted_to.append('general:scenario-name')
 
+    def temp_restrictions(self, parameters):
+        """
+        Apply temporary restricts to script using context manager
+        """
+
+        class TempRestrictions:
+            def __init__(self, _config, _parameters):
+                self.config = _config
+                self.parameters = _parameters
+                self.old_restrictions = None
+
+            def apply(self):
+                self.old_restrictions = self.config.restricted_to
+                self.config.restrict_to(self.parameters)
+
+            def clear(self):
+                self.config.restricted_to = self.old_restrictions
+
+            def __enter__(self):
+                self.apply()
+
+            def __exit__(self, exc_type, exc_val, exc_tb):
+                self.clear()
+
+        return TempRestrictions(self, parameters)
+
     def ignore_restrictions(self):
         """Create a ``with`` block where the config file restrictions are not kept. Usage::
 
diff --git a/cea/interfaces/dashboard/api/project.py b/cea/interfaces/dashboard/api/project.py
index 21e7c36c7..19ae15fc6 100644
--- a/cea/interfaces/dashboard/api/project.py
+++ b/cea/interfaces/dashboard/api/project.py
@@ -121,7 +121,7 @@ class Scenarios(Resource):
         with tempfile.TemporaryDirectory() as tmp:
             config = cea.config.Configuration()
             config.project = tmp
-            config.scenario_name = "temp"
+            config.scenario_name = "temp_scenario"
 
             _project = project or config.project
 
@@ -138,7 +138,11 @@ class Scenarios(Resource):
                 files = payload.get('files')
                 if files is not None:
                     try:
+                        output_path, project_name = os.path.split(config.project)
                         cea.api.create_new_scenario(config,
+                                                    output_path=output_path,
+                                                    project=project_name,
+                                                    scenario=config.scenario_name,
                                                     zone=files.get('zone'),
                                                     surroundings=files.get('surroundings'),
                                                     streets=files.get('streets'),