DeprecationWarning #555

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

Comments

Projects
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\site.py:429: DeprecationWarning: 'U' mode is deprecated
  fp = open(filename, "rU")

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

@dstufft dstufft referenced this issue Jan 5, 2015

Closed

Rewrite virtualenv #697

0 of 5 tasks complete

I am seeing this warning with Python 3.5.1 even though the system package for site.py 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 site.py 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/site.py", line 703, in <module>
    main()
  File ".../.tox/py36-djangomaster/bin/../lib/python3.6/site.py", line 683, in main
    paths_in_sys = addsitepackages(paths_in_sys)
  File ".../.tox/py36-djangomaster/bin/../lib/python3.6/site.py", line 282, in addsitepackages
    addsitedir(sitedir, known_paths)
  File ".../.tox/py36-djangomaster/bin/../lib/python3.6/site.py", line 204, in addsitedir
    addpackage(sitedir, name, known_paths)
  File ".../.tox/py36-djangomaster/bin/../lib/python3.6/site.py", 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

Open

DeprecationWarning: 'U' mode is deprecated #96

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