Python Forum
urllib is not a package traceback
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
urllib is not a package traceback
#1
Hello! I'm in desperate need of help.

I'm attempting to run the following code:
import urllib.request, urllib.parse, urllib.error

fhand = urllib.request.urlopen('http.//data.pr4.org/romeo.txt')
for line in fhand:
    print(line.decode().strip())
and come up with the following:
Error:
File "libby.py", line 1, in <module> import urllib.request, urllib.parse, urllib.error File "/Users/claudiachopek/Desktop/py4e/urllib.py", line 1, in <module> import urllib.request, urllib.parse, urllib.error ModuleNotFoundError: No module named 'urllib.request'; 'urllib' is not a package
If it's of any help, I'm running Python 3.8.5 on Mac OS Catalina 10.15.5

Can someone please tell me why this is happening and how to fix it? I've been doing pretty well with the lessons up till now but can't complete any exercises or examples until I get this figured out.

Thank you in advance!
Reply


Messages In This Thread
urllib is not a package traceback - by cc26 - Aug-28-2020, 04:13 AM
RE: urllib is not a package traceback - by Larz60+ - Aug-28-2020, 04:22 AM
RE: urllib is not a package traceback - by snippsat - Aug-28-2020, 09:34 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  urllib can't find "parse" rjdegraff42 6 2,340 Jul-24-2023, 05:28 PM
Last Post: deanhystad
  Help with urllib.request Brian177 2 2,906 Apr-21-2021, 01:58 PM
Last Post: Brian177
  urllib.request ericmt123 2 2,490 Dec-21-2020, 06:53 PM
Last Post: Larz60+
  urllib request error 404 Coco 2 4,443 May-11-2019, 02:47 PM
Last Post: Larz60+
  KeyError urllib DavidFernandez 4 3,617 Nov-21-2018, 08:34 PM
Last Post: DavidFernandez
  URLLIB.REQUEST Not Working hallofriends 1 6,422 Sep-18-2017, 05:00 PM
Last Post: Larz60+
  how to loop data in urllib? pythonlover 4 7,802 Jan-18-2017, 06:53 PM
Last Post: pythonlover

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020