Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
21491: catching the IndexError instead
Browse files Browse the repository at this point in the history
  • Loading branch information
seblabbe committed Nov 23, 2016
1 parent 27948e8 commit 347aa90
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/sage/geometry/polyhedron/base.py
Expand Up @@ -4258,8 +4258,13 @@ def integral_points_count(self,verbose=False):
err = ":\n" + err
raise RuntimeError("LattE integrale failed (exit code {}) to execute {}".format(ret_code, ' '.join(args)) + err.strip())

with open(SAGE_TMP+'/numOfLatticePoints', 'r') as f:
return Integer(f.read())
try:
return Integer(ans.splitlines()[-1])
except IndexError:
# opening a file is slow (30e-6s), so we read the file
# numOfLatticePoints only in case of a IndexError above
with open(SAGE_TMP+'/numOfLatticePoints', 'r') as f:
return Integer(f.read())

def integral_points(self, threshold=100000):
r"""
Expand Down

0 comments on commit 347aa90

Please sign in to comment.