architecture-building-systems / CityEnergyAnalyst

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

Missing temporary files while running demand script #3613

Closed peppenappi closed 5 months ago

peppenappi commented 5 months ago

Describe the bug While running the demand script using one of my cases, i get an error message saying that a temporary file is missing. Because of that, the total demand csv file cannot be created. However, the analysis for every building is performed and the result files are saved in the directory. I am not sure what is causing the issue, and if it is related to my operative system or to the code.

Error message: Exception ignored in: <function InputLocator.del at 0x000001A084597A60> Exception ignored in: Traceback (most recent call last): <function InputLocator.del at 0x00000228A17C8A60> File "D:\GitHub\CityEnergyAnalyst\CityEnergyAnalyst\CityEnergyAnalyst\cea\inputlocator.py", line 61, in del Traceback (most recent call last): File "D:\GitHub\CityEnergyAnalyst\CityEnergyAnalyst\CityEnergyAnalyst\cea\inputlocator.py", line 61, in del self._cleanup_temp_directory() self._cleanup_temp_directory() Exception ignored in: <function InputLocator.del at 0x0000022ACA998A60> File "D:\GitHub\CityEnergyAnalyst\CityEnergyAnalyst\CityEnergyAnalyst\cea\inputlocator.py", line 66, in _cleanup_temp_directory

File "D:\GitHub\CityEnergyAnalyst\CityEnergyAnalyst\CityEnergyAnalyst\cea\inputlocator.py", line 66, in _cleanup_temp_directory Traceback (most recent call last): shutil.rmtree(self._temp_directory) File "D:\GitHub\CityEnergyAnalyst\CityEnergyAnalyst\CityEnergyAnalyst\cea\inputlocator.py", line 61, in del

  File "D:\GitHub\dependencies\micromamba\envs\cea\lib\shutil.py", line 740, in rmtree

shutil.rmtree(self._temp_directory) self._cleanup_temp_directory() File "D:\GitHub\dependencies\micromamba\envs\cea\lib\shutil.py", line 740, in rmtree

File "D:\GitHub\CityEnergyAnalyst\CityEnergyAnalyst\CityEnergyAnalyst\cea\inputlocator.py", line 66, in _cleanup_temp_directory return _rmtree_unsafe(path, onerror) shutil.rmtree(self._temp_directory) File "D:\GitHub\dependencies\micromamba\envs\cea\lib\shutil.py", line 618, in _rmtree_unsafe

return _rmtree_unsafe(path, onerror) File "D:\GitHub\dependencies\micromamba\envs\cea\lib\shutil.py", line 740, in rmtree

  File "D:\GitHub\dependencies\micromamba\envs\cea\lib\shutil.py", line 618, in _rmtree_unsafe

onerror(os.unlink, fullname, sys.exc_info()) File "D:\GitHub\dependencies\micromamba\envs\cea\lib\shutil.py", line 616, in _rmtree_unsafe return _rmtree_unsafe(path, onerror)
onerror(os.unlink, fullname, sys.exc_info()) File "D:\GitHub\dependencies\micromamba\envs\cea\lib\shutil.py", line 618, in _rmtree_unsafe os.unlink(fullname) File "D:\GitHub\dependencies\micromamba\envs\cea\lib\shutil.py", line 616, in _rmtree_unsafe FileNotFoundError: [WinError 2] The system cannot find the file specified: 'C:\Users\gnappi\AppData\Local\Temp\tmpwa0ffun5\B1001T.csv'onerror(os.unlink, fullname, sys.exc_info()) os.unlink(fullname)

FileNotFoundError File "D:\GitHub\dependencies\micromamba\envs\cea\lib\shutil.py", line 616, in _rmtree_unsafe : [WinError 2] The system cannot find the file specified: 'C:\Users\gnappi\AppData\Local\Temp\tmpwa0ffun5\B1001T.csv' os.unlink(fullname) FileNotFoundError: [WinError 2] The system cannot find the file specified: 'C:\Users\gnappi\AppData\Local\Temp\tmpwa0ffun5\B1007T.csv' Traceback (most recent call last): File "D:\GitHub\CityEnergyAnalyst\CityEnergyAnalyst\CityEnergyAnalyst\cea\worker.py", line 146, in worker run_job(config, job, server) File "D:\GitHub\CityEnergyAnalyst\CityEnergyAnalyst\CityEnergyAnalyst\cea\worker.py", line 108, in run_job script(config=config, *parameters) File "D:\GitHub\CityEnergyAnalyst\CityEnergyAnalyst\CityEnergyAnalyst\cea\api.py", line 60, in call self._runner.call(args, kwargs) File "D:\GitHub\CityEnergyAnalyst\CityEnergyAnalyst\CityEnergyAnalyst\cea\api.py", line 38, in script_runner script_module.main(config) File "D:\GitHub\CityEnergyAnalyst\CityEnergyAnalyst\CityEnergyAnalyst\cea\demand\demand_main.py", line 145, in main demand_calculation(locator=locator, config=config) File "D:\GitHub\CityEnergyAnalyst\CityEnergyAnalyst\CityEnergyAnalyst\cea\demand\demand_main.py", line 122, in demand_calculation writer_totals.write_to_csv(building_names, locator) File "D:\GitHub\CityEnergyAnalyst\CityEnergyAnalyst\CityEnergyAnalyst\cea\demand\demand_writers.py", line 167, in write_to_csv df = pd.read_csv(temporary_file) File "D:\GitHub\dependencies\micromamba\envs\cea\lib\site-packages\pandas\io\parsers\readers.py", line 912, in read_csv return _read(filepath_or_buffer, kwds) File "D:\GitHub\dependencies\micromamba\envs\cea\lib\site-packages\pandas\io\parsers\readers.py", line 577, in _read parser = TextFileReader(filepath_or_buffer, kwds) File "D:\GitHub\dependencies\micromamba\envs\cea\lib\site-packages\pandas\io\parsers\readers.py", line 1407, in init self._engine = self._make_engine(f, self.engine) File "D:\GitHub\dependencies\micromamba\envs\cea\lib\site-packages\pandas\io\parsers\readers.py", line 1661, in _make_engine self.handles = get_handle( File "D:\GitHub\dependencies\micromamba\envs\cea\lib\site-packages\pandas\io\common.py", line 859, in get_handle handle = open( FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\gnappi\AppData\Local\Temp\tmpwa0ffun5\B1000T.csv'

To Reproduce Steps to reproduce the behavior:

  1. Create a scenario and run the demand script
  2. The simulation will run until the end where an error message will appear

Hardware (please complete the following information):

ShiZhongming commented 5 months ago

Hi @peppenappi

Thanks for the message. This issue has been resolved with CEA v3.37.0. It should be fine if you upgrade.