3

EnergyPlus Eppy saveas function

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.

nancynanxiaodan's avatar
387
nancynanxiaodan
asked 2015-09-28 10:39:27 -0500, updated 2015-09-28 10:44:19 -0500
edit flag offensive 0 remove flag 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 -0500) 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 -0500) edit
add a comment see more comments

1 Answer

2

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.

santoshphilip's avatar
961
santoshphilip
answered 2015-09-28 11:08:51 -0500
edit flag offensive 0 remove flag delete link

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 -0500) 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 -0500) 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 -0500) 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 -0500) edit
add a comment see more comments