DeprecationWarning #555

cool-RR opened this Issue Jan 26, 2014 · 2 comments


None yet
3 participants

cool-RR commented Jan 26, 2014

Getting this error on Python 3.4b2 on Windows 7:

c:\venvs\my_env\lib\ DeprecationWarning: 'U' mode is deprecated
  fp = open(filename, "rU")

For some reason Virtualenv creates a module with code that uses the deprecated U flag.

@dstufft dstufft referenced this issue Jan 5, 2015


Rewrite virtualenv #697

0 of 5 tasks complete

I am seeing this warning with Python 3.5.1 even though the system package for does not have this deprecation warning. What's unfortunate is that it keeps me from running unit tests with -Werror because it fails in this virtualenv even when the system one would not have generated it.

rpkilby commented Jan 17, 2017

This is the stack trace currently generated on python 3.4+ when using the -Werror option:

Failed to import the site module
Traceback (most recent call last):
  File ".../.tox/py36-djangomaster/bin/../lib/python3.6/", line 703, in <module>
  File ".../.tox/py36-djangomaster/bin/../lib/python3.6/", line 683, in main
    paths_in_sys = addsitepackages(paths_in_sys)
  File ".../.tox/py36-djangomaster/bin/../lib/python3.6/", line 282, in addsitepackages
    addsitedir(sitedir, known_paths)
  File ".../.tox/py36-djangomaster/bin/../lib/python3.6/", line 204, in addsitedir
    addpackage(sitedir, name, known_paths)
  File ".../.tox/py36-djangomaster/bin/../lib/python3.6/", line 165, in addpackage
    f = open(fullname, "rU")
DeprecationWarning: 'U' mode is deprecated

It turns out that this method is used to add packages from .pth files. In my case, pytest-cov had added a custom .pth.

jfbu referenced this issue in sphinx-doc/sphinx Jun 26, 2017

@tiran tiran referenced this issue in python-ldap/python-ldap Dec 4, 2017


DeprecationWarning: 'U' mode is deprecated #96

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment