Commit e12a68be authored by Stefan Krah's avatar Stefan Krah

Issue #27241: Catch exception when running pstats as main.

parent 7bfbd1d3
......@@ -574,7 +574,10 @@ if __name__ == '__main__':
def do_add(self, line):
if self.stats:
self.stats.add(line)
try:
self.stats.add(line)
except IOError as e:
print("Failed to load statistics for %s: %s" % (line, e), file=self.stream)
else:
print("No statistics object is loaded.", file=self.stream)
return 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment