[Tutor] Question on tell() function and error produced

Henry Steigerwaldt hsteiger@comcast.net
Fri Feb 14 21:18:04 2003


To All:

Can anyone tell me how to use the tell( ) function when 
accessing data on the Web?

I know how to use it when reading a file from the hard drive,
but I get an error using it after reading text via the Web and
then trying to use it on that particular "file object."

Part of the code I am using follows.
________________________________

from Tkinter import *
import os
from time import gmtime
import re
import string
import urllib

fwcURL = "http://isl715.nws.noaa.gov/tdl/forecast/fwc.txt"

try:
      f_object = urllib.urlopen(fwcURL)
      fwcall = f_object.read()
      location = f_object.tell()
      print location
   except:
      print "Could not obtain data from Web"
      return
__________________________
Here is the error I am getting and I am not sure how to
prevent it:
__________
  Traceback (most recent call last):
  File "C:\python_pgms\plot_guidance\plot_guidance_fm_web.py", line 123, in
      Main location = f_object.tell()
 AttributeError: addinfourl instance has no attribute 'tell'
_____________________
How can I prevent this error? I guess I could save the data to a file,
then open the file and read it, THEN use the tell ( ) (and for that
matter the seek( ) ) function like I am accustomed to doing
successfully in the past. But I should be able to use it as is on the
file object.

Thanks much.

Henry Steigerwaldt
Hermitage, TN
Email:  hsteiger@comcast.net