architecture-building-systems / CityEnergyAnalyst

The City Energy Analyst (CEA)
https://www.cityenergyanalyst.com/
MIT License
194 stars 61 forks source link

creat scenario failed #3499

Closed yameima closed 6 months ago

yameima commented 6 months ago

Describe the bug A clear and concise description of what the bug is. zone_helper: local variable 'response' referenced before assignment To Reproduce Steps to reproduce the behavior:

  1. Go to '. console.log ..'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behaviour A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Hardware (please complete the following information):

ShiZhongming commented 6 months ago

Hi @yameima We could not replicate your error. Could you elaborate?

yameima commented 6 months ago

Hi,this problem is when I was creating new scenario, I selected the area I needed, and an error was reported in the creation, as shown in the picture. What is the reason for this, thank you for your help 屏幕截图 2024-02-27 205811

urllib3.exceptions.SSLError: TLS/SSL connection has been closed (EOF) (_ssl.c:1131)

The above exception was the direct cause of the following exception:

urllib3.exceptions.ProxyError: ('Unable to connect to proxy', SSLError(SSLZeroReturnError(6, 'TLS/SSL connection has been closed (EOF) (_ssl.c:1131)')))

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "D:\CEA\CityEnergyAnalyst\dependencies\micromamba\envs\cea\lib\site-packages\requests\adapters.py", line 486, in send resp = conn.urlopen( File "D:\CEA\CityEnergyAnalyst\dependencies\micromamba\envs\cea\lib\site-packages\urllib3\connectionpool.py", line 847, in urlopen retries = retries.increment( File "D:\CEA\CityEnergyAnalyst\dependencies\micromamba\envs\cea\lib\site-packages\urllib3\util\retry.py", line 515, in increment raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='overpass-api.de', port=443): Max retries exceeded with url: /api/status (Caused by ProxyError('Unable to connect to proxy', SSLError(SSLZeroReturnError(6, 'TLS/SSL connection has been closed (EOF) (_ssl.c:1131)'))))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "D:\CEA\CityEnergyAnalyst\dependencies\micromamba\envs\cea\lib\site-packages\osmnx_overpass.py", line 131, in _get_overpass_pause response = requests.get( File "D:\CEA\CityEnergyAnalyst\dependencies\micromamba\envs\cea\lib\site-packages\requests\api.py", line 73, in get return request("get", url, params=params, kwargs) File "D:\CEA\CityEnergyAnalyst\dependencies\micromamba\envs\cea\lib\site-packages\requests\api.py", line 59, in request return session.request(method=method, url=url, kwargs) File "D:\CEA\CityEnergyAnalyst\dependencies\micromamba\envs\cea\lib\site-packages\requests\sessions.py", line 589, in request resp = self.send(prep, send_kwargs) File "D:\CEA\CityEnergyAnalyst\dependencies\micromamba\envs\cea\lib\site-packages\requests\sessions.py", line 703, in send r = adapter.send(request, kwargs) File "D:\CEA\CityEnergyAnalyst\dependencies\micromamba\envs\cea\lib\site-packages\requests\adapters.py", line 513, in send raise ProxyError(e, request=request) requests.exceptions.ProxyError: HTTPSConnectionPool(host='overpass-api.de', port=443): Max retries exceeded with url: /api/status (Caused by ProxyError('Unable to connect to proxy', SSLError(SSLZeroReturnError(6, 'TLS/SSL connection has been closed (EOF) (_ssl.c:1131)'))))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "D:\CEA\CityEnergyAnalyst\dependencies\micromamba\envs\cea\lib\site-packages\cea\interfaces\dashboard\api\project.py", line 176, in post cea.api.zone_helper(config) File "D:\CEA\CityEnergyAnalyst\dependencies\micromamba\envs\cea\lib\site-packages\cea\api.py", line 60, in call self._runner.call(*args, **kwargs) File "D:\CEA\CityEnergyAnalyst\dependencies\micromamba\envs\cea\lib\site-packages\cea\api.py", line 38, in script_runner script_module.main(config) File "D:\CEA\CityEnergyAnalyst\dependencies\micromamba\envs\cea\lib\site-packages\cea\datamanagement\zone_helper.py", line 600, in main zone_helper(locator, config) File "D:\CEA\CityEnergyAnalyst\dependencies\micromamba\envs\cea\lib\site-packages\cea\datamanagement\zone_helper.py", line 351, in zone_helper zone_df = polygon_to_zone(buildings_floors, buildings_floors_below_ground, buildings_height, File "D:\CEA\CityEnergyAnalyst\dependencies\micromamba\envs\cea\lib\site-packages\cea\datamanagement\zone_helper.py", line 503, in polygon_to_zone shapefile = osmnx.features.features_from_polygon(polygon=poly['geometry'].values[0], tags={"building": True}) File "D:\CEA\CityEnergyAnalyst\dependencies\micromamba\envs\cea\lib\site-packages\osmnx\features.py", line 336, in features_from_polygon return _create_gdf(response_jsons, polygon, tags) File "D:\CEA\CityEnergyAnalyst\dependencies\micromamba\envs\cea\lib\site-packages\osmnx\features.py", line 427, in _create_gdf for response_json in response_jsons: File "D:\CEA\CityEnergyAnalyst\dependencies\micromamba\envs\cea\lib\site-packages\osmnx_overpass.py", line 352, in _download_overpass_features yield _overpass_request(data={"data": query_str}) File "D:\CEA\CityEnergyAnalyst\dependencies\micromamba\envs\cea\lib\site-packages\osmnx_overpass.py", line 386, in _overpass_request this_pause = _get_overpass_pause(settings.overpass_endpoint) File "D:\CEA\CityEnergyAnalyst\dependencies\micromamba\envs\cea\lib\site-packages\osmnx_overpass.py", line 141, in _get_overpass_pause utils.log(f"Unable to query {url}, got status {response.status_code}", level=lg.ERROR) UnboundLocalError: local variable 'response' referenced before assignment

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "D:\CEA\CityEnergyAnalyst\dependencies\micromamba\envs\cea\lib\site-packages\flask\app.py", line 1484, in full_dispatch_request rv = self.dispatch_request() File "D:\CEA\CityEnergyAnalyst\dependencies\micromamba\envs\cea\lib\site-packages\flask\app.py", line 1469, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(view_args) File "D:\CEA\CityEnergyAnalyst\dependencies\micromamba\envs\cea\lib\site-packages\flask_restx\api.py", line 402, in wrapper resp = resource(args, kwargs) File "D:\CEA\CityEnergyAnalyst\dependencies\micromamba\envs\cea\lib\site-packages\flask\views.py", line 109, in view return current_app.ensure_sync(self.dispatch_request)(kwargs) File "D:\CEA\CityEnergyAnalyst\dependencies\micromamba\envs\cea\lib\site-packages\flask_restx\resource.py", line 41, in dispatch_request resp = meth(args, kwargs) File "D:\CEA\CityEnergyAnalyst\dependencies\micromamba\envs\cea\lib\site-packages\cea\interfaces\dashboard\api\project.py", line 186, in post raise Exception(f'{tool}_helper: {e}') from e Exception: zone_helper: local variable 'response' referenced before assignment

reyery commented 6 months ago

Hi @yameima,

It seems that your machine is unable to connect to the OpenStreetMap api to fetch the geometries. Could you try to open this link https://overpass-api.de/api/status on your browser and let us know if you are open to receive any response. Thanks!

yameima commented 6 months ago

Hi @yameima,

It seems that your machine is unable to connect to the OpenStreetMap api to fetch the geometries. Could you try to open this link https://overpass-api.de/api/status on your browser and let us know if you are open to receive any response. Thanks!

Hi,when I open this link just like the follow picture ![Uploading image.png…]()

yameima commented 6 months ago

Hi,when I open this link just like the follow picture image

yameima commented 6 months ago

The issue has been resolved and I am now able to create scenario. Thank you!

reyery commented 6 months ago

@yameima I am glad that it works for you now. Did you do anything to solve this on your end?