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

Fix Python 3 'urllib' error message #71

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

cederlys
Copy link

When using Python 3.9.7, simply starting pyShell() produces this error
message:

AttributeError: module 'urllib' has no attribute 'request'

Fix, by importing urllib.request before attempting to use
urllib.request.urlopen.

This small demo program triggers the error:

#!/usr/bin/env python3

import sys
import time

from pyShelly import pyShelly

shelly = pyShelly()

while True:
    try:
        time.sleep(60)
    except KeyboardInterrupt:
        print("Bye!")
        sys.exit(0)

When using Python 3.9.7, simply starting pyShell() produces this error
message:

    AttributeError: module 'urllib' has no attribute 'request'

Fix, by importing urllib.request before attempting to use
urllib.request.urlopen.
@e-v-k
Copy link

e-v-k commented Oct 18, 2022

Would be great if this could be merged to master.

@kornpow
Copy link

kornpow commented Nov 1, 2023

Ran into this issue as well. Running Python 3.11. Seems strange that a library which seems to be well maintained has show-stopping issue when trying to run the demo application in the README? Maybe HA has an older Python3 bundled in and this hasnt been prioritized?

Co-authored-by: Andreas Motl <[email protected]>
@ramack
Copy link

ramack commented Jun 5, 2024

It would be cool, if we can have this merged and released!

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

Successfully merging this pull request may close these issues.

6 participants