1 Replies - 439 Views - Last Post: 28 February 2014 - 04:40 PM Rate Topic: -----

#1 JNicki  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 47
  • Joined: 27-February 14

urllib.urlopen doesnt open anything?! Python 3 Help Please!

Posted 28 February 2014 - 04:26 PM

Python 3.3.5rc1 (v3.3.5rc1:9ec811df548e, Feb 23 2014, 10:41:24) [MSC v.1600 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.

>>> import urllib
>>> u = urllib.parse.urlopen('http://ctabustracker.com/bustime/map/getBusesForRoute.jsp?route=22')

Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
u = urllib.parse.urlopen('http://ctabustracker.com/bustime/map/getBusesForRoute.jsp?route=22')
AttributeError: 'module' object has no attribute 'parse'

>>> u = urllib.urlopen('http://ctabustracker.com/bustime/map/getBusesForRoute.jsp?route=22')

Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
u = urllib.urlopen('http://ctabustracker.com/bustime/map/getBusesForRoute.jsp?route=22')
AttributeError: 'module' object has no attribute 'urlopen'

>>>

Is This A Good Question/Topic? 0
  • +

Replies To: urllib.urlopen doesnt open anything?! Python 3 Help Please!

#2 jon.kiparsky  Icon User is offline

  • Pancakes!
  • member icon


Reputation: 7961
  • View blog
  • Posts: 13,579
  • Joined: 19-March 11

Re: urllib.urlopen doesnt open anything?! Python 3 Help Please!

Posted 28 February 2014 - 04:40 PM

Looks like you're trying to use a 2.something tutorial example in 3.something.

Try looking at the docs for 3:
http://docs.python.o...ib.request.html

This might help you get started:

>>> from urllib import request
>>> u = urllib.request.urlopen('http://ctabustracker.com/bustime/map/getBusesForRoute.jsp?route=22')


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1