This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author yan12125
Recipients abarry, ezio.melotti, gvanrossum, jayvdb, martin.panter, python-dev, r.david.murray, serhiy.storchaka, terry.reedy, vstinner, yan12125, ztane
Date 2016-09-11.09:35:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Currently the deprecation message is not so useful when fixing lots of files in a large project. For example, I have two files and

import bar


It gives:
$ python3.6 -W error
Traceback (most recent call last):
  File "", line 1, in <module>
    import bar
DeprecationWarning: invalid escape sequence '\d'

Things are worse when __import__, imp or importlib are involved. I have to add some codes to show which module is imported.

It would be better to have at least filenames and line numbers:
$ ./python -W error
Traceback (most recent call last):
  File "", line 1, in <module>
    import bar
  File "/home/yen/Projects/cpython/build/", line 1
SyntaxError: (deprecated usage) invalid escape sequence '\d'

I have a naive try that prints more information. Raising SyntaxError may not be a good idea, anyway.
Date User Action Args
2016-09-11 09:35:50yan12125setrecipients: + yan12125, gvanrossum, terry.reedy, vstinner, ezio.melotti, r.david.murray, python-dev, martin.panter, serhiy.storchaka, ztane, jayvdb, abarry
2016-09-11 09:35:50yan12125setmessageid: <>
2016-09-11 09:35:50yan12125linkissue27364 messages
2016-09-11 09:35:50yan12125create