Brett Cannon added the comment: Because parsing is done before execution you can't flip on warnings during runtime in the file you to be affected.
As for the line number, that's because it's raise in C code that doesn't have a trigger in Python code. Try importing the code and you should get the line number of the import. Otherwise you will have to check if there is some function to specify a syntax warning that lets you set the line number explicitly (I don't think there is). ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26182> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com