First time here? Check out the Help page!

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 9 years ago

nancynanxiaodan's avatar

updated 9 years ago

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.

Preview: (hide)

Comments

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

Jeremy's avatar Jeremy  ( 9 years ago )

@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  ( 9 years ago )

1 Answer

Sort by » oldest newest most voted
2

answered 9 years ago

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.

Preview: (hide)
link

Comments

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

santoshphilip's avatar santoshphilip  ( 9 years ago )

@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  ( 9 years ago )

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

nancynanxiaodan's avatar nancynanxiaodan  ( 9 years ago )

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  ( 9 years ago )

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: 9 years ago

Seen: 393 times

Last updated: Sep 28 '15