Commit d4f313b3 authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

better handling of out-of-memory error

parent c3c04cbc
......@@ -839,6 +839,7 @@ def parse_option(opt, just_file=False):
val_type = values[1].strip()
expr = values[2]
edit_vars = dict()
exec "from math import *\n" in edit_vars
if "file:" in expr:
expressions = expr.split("file:")
if len(expressions) > 1:
......@@ -1093,6 +1094,12 @@ except (OptionError, HistoryException, IOError, RuntimeError), e:
except KeyboardInterrupt:
print >> sys.stderr, "graph-tool error: Keyboard interrupt."
sys.exit(1)
except MemoryError, e:
error = str(e)
if error != "":
print >> sys.stderr, "graph-tool error: out of memory. (text:", error, ")"
else:
print >> sys.stderr, "graph-tool error: out of memory."
except:
(file_name, line, function, text) = traceback.extract_tb(sys.exc_info()[2])[-1]
print >> sys.stderr, "graph-tool unknown error: ", sys.exc_info()[1], "[traceback: File %s, line %d, in %s (text: %s)]" % (file_name, line, function, str(text))
......
Supports Markdown
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