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: 'U' mode is deprecated #891

Closed
nskalis opened this issue Oct 14, 2018 · 1 comment · Fixed by #984
Closed

DeprecationWarning: 'U' mode is deprecated #891

nskalis opened this issue Oct 14, 2018 · 1 comment · Fixed by #984

Comments

@nskalis
Copy link

nskalis commented Oct 14, 2018

Hi,

In Python3 the following is deprecated. This is causing pyez to give warnings when running in any CI environment.

/usr/lib/python3.6/site-packages/jnpr/junos/utils/config.py:501: DeprecationWarning: 'U' mode is deprecated
  rpc_contents = open(kvargs['path'], 'rU').read()
@stacywsmith
Copy link
Contributor

Suggest replacing current /usr/lib/python3.6/site-packages/jnpr/junos/utils/config.py:501:

    rpc_contents = open(kvargs['path'], 'rU').read()

with:

    try:
        # Explicitly request Python 3.x universal newline 
        rpc_contents = open(kvargs['path'], 'r', newline=None).read()
    except TypeError:
        # Fallback to Python 2.x universal newline 
        rpc_contents = open(kvargs['path'], 'rU').read()

See this question and answer.

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

Successfully merging a pull request may close this issue.

4 participants