Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question
3

EnergyPlus Eppy saveas function

asked 2015-09-28 10:39:27 -0600

nancynanxiaodan's avatar

updated 2015-09-28 10:44:19 -0600

Hi all, I am new to Eppy. went through the tutorial from the website. It seems can be used very straight forward. And my question here is about the function of SAVEAS.

I noticed that there are 3 save functions in eppy.modeleditor. one is save which works fine, and one is saveas which I tried and did not give me the expected output, same issue with savecopy.

I used following commends:

idf1.save() which save the changes I made in IDF file and save it in original idf file.

idf1.saveas("test") which didnt give me any error, however, no "test" file saved.

idf1.savecopy("test") which did not give me any error either, however, no "test" file saved.

I checked with the origin python code of eppy.modeleditor of the function save saveas savecopy. However, I have no idea, which part went wrong when I am trying to save it to a new file named test not in original file.

def saveas(self, filename, lineendings='default'):
    self.idfname = filename
    self.save(lineendings=lineendings)

def savecopy(self, filename, lineendings='default'):
    """save a copy as filename"""
    self.save(filename, lineendings=lineendings)

Thanks for your help and kind support Thanks again.

edit retag flag offensive close merge delete

Comments

The function has always worked for me. @nancynanxiaodan could you post your script?

Jeremy's avatar Jeremy  ( 2015-09-28 10:54:58 -0600 )edit

@Jeremy Thanks. I should give a full path rather than just a name of 'test.idf' it works fine now. Thanks sorry for this silly question.

nancynanxiaodan's avatar nancynanxiaodan  ( 2015-09-28 12:38:20 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2015-09-28 11:08:51 -0600

santoshphilip's avatar

It should work. Rather ... it has always worked for me too.

Try it with the full path name "C:\somewhere\test.idf" and let us know. It may be saving the file where you are not expecting it to.

edit flag offensive delete link more

Comments

I suppose I should have posted this as a comment rather than an answer :-(

santoshphilip's avatar santoshphilip  ( 2015-09-28 11:09:46 -0600 )edit

@santoshphilip yeah I think so, probably it stored somewhere I did not expect.. I will try, if it is not working, I will post my script. Thanks

nancynanxiaodan's avatar nancynanxiaodan  ( 2015-09-28 12:26:18 -0600 )edit

Thanks! I should give a certain path rather than just a 'test' name. It works fine now.

nancynanxiaodan's avatar nancynanxiaodan  ( 2015-09-28 12:36:55 -0600 )edit

It will work even without the full path name. It will save it in the directory you are running your script. You can also give relative paths such as "test.idf", "./test.idf", "../test.idf", "../../somewhere/test.idf". They should all work. Note that you use a frontslash "/" even on a windows platform, not a backslash "\".

santoshphilip's avatar santoshphilip  ( 2015-09-28 13:34:45 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Training Workshops

Careers

Question Tools

1 follower

Stats

Asked: 2015-09-28 10:39:27 -0600

Seen: 374 times

Last updated: Sep 28 '15