ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-Tutor
python-Tutor
[Tutor] Question on tell() function and error produced
by Henry Steigerwaldt other posts by this author
Aug 26 2002 7:19AM messages near this date
Re: [Tutor] Re: complex numbers: j vs. i | Re: [Tutor] Question on tell() function and error produced
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@[...].net



_______________________________________________
Tutor maillist  -  Tutor@[...].org
http://mail.python.org/mailman/listinfo/tutor
Thread:
Henry Steigerwaldt
Jeff Shannon

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved