I wrote: > I've noticed that some (many) Python-level error messages (e.g., syntax > errors) from Sage 9.5.beta8 fail to give the name of the source file > in which the error occured. [[...]]
On Sat, Jan 08, 2022 at 10:24:07PM -0500, Michael Orlitzky replied: > I think the load() method has been superseded by whatever magic ipython > offers. I'm not an expert, but I think > > sage: %run <file> > > will give you a better error message. Thanks for the suggestion. A bit of poking around shows that the sage input sage: run 'file-name' will work nicely. (There's no initial '%' sign -- the sage preparser adds that back on.) Alas, this is ONLY valid at the top-level ipython/sage REPL. Inside a 'run-ed' file, the run command doesn't work (it's a syntax error regardless of whether it's spelled 'run' or '%run'). More generally, suppose I have a bunch of Sage assignments-to-globals and function definitions in several files, say foo.sage bar.sage baz.sage what's the idiomatic way for some other piece of Sage source code to execute the contents of all of those files? What I've been doing is to create another file (say 'setup.sage') which contains the lines load('foo.sage') load('bar.sage') load('baz.sage') so that load('setup.sage') (either at the interactive Sage prompt or in another source file) loads all the individual files. This works fine apart from the un-helpful error messages when (not if, *when*) I have bugs in my code. Is there a more idiomatic way? -- -- "Jonathan Thornburg [remove color- to reply]" <jthorn4...@pink-gmail.com> on the west coast of Canada, eh? "There was of course no way of knowing whether you were being watched at any given moment. How often, or on what system, the Thought Police plugged in on any individual wire was guesswork. It was even conceivable that they watched everybody all the time." -- George Orwell, "1984" -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/YdqOcqD%2B85Lcc4Rn%40gold.bkis-orchard.net.