[Tutor] AttributeError: 'str' object has no attribute 'geturl'

Javier Ruere javier at ruere.com.ar
Sat Oct 8 21:59:24 CEST 2005

Joseph Quigley wrote:
> Well, I'm back to coding more on my comic downloader and viewer and I 
> keep getting this error:
> Traceback (most recent call last):
>   File "F:\Gacor\getgarf.py", line 244, in ?
>     getImg(Data.todayStrip)
>   File "F:\Gacor\getgarf.py", line 127, in getImg
>     Data.f.geturl()
> AttributeError: 'str' object has no attribute 'geturl'

  Class Data has a class attribute, 'f', defined as an empty string. Check if Data.f is initialized before calling getImg.
  Also, why initialize with an empty str? Put a None in there or don't define the attribute at all.
  A tip: in line 126 there is a print Data.f. This will show nothing in this case. When printing for debugging, error reporting or user input, always place quotes around values so that it is easier to spot empty strings or non printable characters.
  Finally, keep in mind that you can always use pdb to see what's up.


More information about the Tutor mailing list