Skip to content
Discussion options

You must be logged in to vote

When you execute code, say with ExecString, CheckError is called at the end which on exception updates PythoneEngine.Traceback. and raises a suitable EPythonError descendent exception.

type
  EPythonError   = class(Exception)
    public
      EName : string;
      EValue : string;
  end;

  TTracebackItem = class
  public
    FileName : string;
    LineNo : Integer;
    Context : string;
  end;

  TPythonTraceback = class
    public
      property ItemCount : Integer read GetItemCount;
      property Items[ idx : Integer ] : TTracebackItem read GetItem;
      property Limit : Integer read FLimit write FLimit;
  end;

So what you typically do is:

try
  ExecString(Code, FileName);
except

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@chicknsoup
Comment options

Answer selected by chicknsoup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants