How do I exec a user script and note errors?
Robert Ferrell
ferrell at diablotech.com
Wed Dec 18 16:45:15 EST 2002
I want to read in (and execute) a user python file. I know I can do
that with execfile(). However, I want to catch some errors that the
user might have made. If I read the file line at a time, and exec
each line, I can use try:/except:. However, that doesn't work if the
user has function defitions, or other multi-line code blocks in the
file.
What is a good python way to accomplish what I want?
thanks,
-robert
More information about the Python-list
mailing list