Skip to content

Commit

Permalink
Automatic Sync from SCM-svn to GitHub
Browse files Browse the repository at this point in the history
syncing the following commits:
RobertRueger: fix issue with closing files for PLAMS trajectories SO--
  • Loading branch information
scmtestadf committed May 25, 2022
1 parent fe99e95 commit 4737052
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions trajectories/trajectoryfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,6 @@ def __exit__ (self, exc_type, exc_val, exc_tb) :
"""
self.close()

def __del__ (self) :
"""
If self.file_object is a regular fileobject, close it
"""
try :
self.file.close()
except AttributeError :
pass

def get_elements (self) :
"""
Get the elements attribute
Expand Down Expand Up @@ -145,9 +136,10 @@ def get_plamsmol (self) :

def close (self) :
"""
Cleanly close and garbage collect the file
Close the file
"""
del(self)
if hasattr(self.file_object, 'close'):
self.file_object.close()

def read_next (self, molecule=None, read=True) :
"""
Expand Down

0 comments on commit 4737052

Please sign in to comment.