Its not brain surgery, but you want 1) Apply the preparser, possibly other input transformations
2) handle syntax errors from the preparser and show an appropriate error (not: a traceback inside the preparser) 3) handle errors from the string -> ast compilation and show an appropriate error 4) put the source into traceback.linecache 5) beautify the traceback IPython does all these things already. Loading code from a file is just loading + evaluating the loaded string. On Friday, November 21, 2014 5:08:50 PM UTC, Jeroen Demeyer wrote: > > On 2014-11-21 15:29, Volker Braun wrote: > > You don't have to use IPython interactively, just use its machinery for > > evaluating code-from-a-string instead of reinventing the wheel. > What's wrong with exec(compile())? There is not much reinvented in that. > > Note that it's not just code evaluated from a string, it's also stuff > like load() and attach(). I don't know if there are IPython equivalents > for those. > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.