santoshphilip / eppy

scripting language for E+, Energyplus
MIT License
151 stars 67 forks source link

Error when running IDF(idfname) #426

Open waynetsu opened 1 year ago

waynetsu commented 1 year ago

Hi, I tried to run idf files using eppy. However, it just does't work when it comes to "idf1 = IDF(idfname)". I don't know what is going on and just couldn't get over this issue.

I am using Pycharm 2022.2.1 (Community Edition) and the eppy package was installed by miniconda 3. The python version is 3.7. I tried two versions of eppy (v0.5.51 and v0.5.63), but the error still exits. The operating system is Windows 10 Professional 22H2.

The error says:

Traceback (most recent call last):
  File "D:\ProgramData\miniconda3\envs\Python_v3.7\lib\code.py", line 90, in runcode
    exec(code, self.locals)
  File "<input>", line 32, in <module>
  File "D:\ProgramData\miniconda3\envs\Python_v3.7\lib\site-packages\eppy\modeleditor.py", line 579, in __init__
    self.read()
  File "D:\ProgramData\miniconda3\envs\Python_v3.7\lib\site-packages\eppy\modeleditor.py", line 713, in read
    self.idfname, self.iddname, self, commdct=self.idd_info, block=self.block
  File "D:\ProgramData\miniconda3\envs\Python_v3.7\lib\site-packages\eppy\idfreader.py", line 274, in idfreader1
    convertallfields(data, commdct, block)
  File "D:\ProgramData\miniconda3\envs\Python_v3.7\lib\site-packages\eppy\idfreader.py", line 170, in convertallfields
    for key in list(data.dt.keys()):
AttributeError: 'Eplusdata' object has no attribute 'dt'

The original code:

The original code:
import sys
import os
import time
import glob
import pandas as pd
import math
from eppy import modeleditor  
from eppy.modeleditor import IDF
import numpy as np
sys.path.append(r'D:\PythonCode\Eppy')
from self_defined_function.qlwr_emi_atm import Qlwr_spectral
# ------------------------------------
start_clock = time.time()  
EP_version="V22-1-0" 
sys.path.insert(0, 'D:/EnergyPlus'+EP_version)
# ------------------------------------
iddfile = r'D:\EnergyPlus'+EP_version+'\Energy+.idd'
path_dir0 = r'D:\PythonCode\Eppy' 
idfname = glob.glob(r'D:\PythonCode\Eppy\resources\idffile\SimpleModel.idf')
epwfile = r'D:\EnergyPlus\epw\NB.epw'
outputdirectory = glob.glob(path_dir0 + r'\output')
# ------------------------------------
IDF.setiddname(iddfile)  
idf1 = IDF(idfname)  
santoshphilip commented 1 year ago

At first glance, that code should work. Not sure what is going wroing. I need to try and recreate that error

waynetsu commented 1 year ago

At first glance, that code should work. Not sure what is going wroing. I need to try and recreate that error

Thanks for your reply.

Actually, the same code worked previously in my old computer. However, after I got a new computer (the old one is window 7) and recreate the python environment, it doesn't work properly. It has been quite a long time and I am not able to get access to my old computer, so I am not sure whether I created exactly the same environment as previous.

I would appreciate it if you could help me solve this problem.