Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DeprecationWarning #555

Closed
cool-RR opened this issue Jan 26, 2014 · 4 comments
Closed

DeprecationWarning #555

cool-RR opened this issue Jan 26, 2014 · 4 comments

Comments

@cool-RR
Copy link

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 mentioned this issue Jan 5, 2015
5 tasks
@johnthagen
Copy link

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
Copy link

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.

@johnthagen
Copy link

Has this been fixed?

fp = open(filename, "r")

@gaborbernat
Copy link
Contributor

Yes.

p00ya added a commit to p00ya/climbing_ratings that referenced this issue Apr 12, 2020
Python 3.8 is stable and has been around for 6 months.  It also includes
PEP 590 (vectorcall), which is expected to yield performance
improvements with Cython 3.

However, many distros still use 3.7 (e.g. homebrew, buster, eoan), so
keep a job testing on 3.7.

Also switch from default (Xenial) to Bionic, because Xenial's virtualenv
has warnings (pypa/virtualenv#555).
@pypa pypa locked and limited conversation to collaborators Jan 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants