Broken Library Code, suggested course of action

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Melih Onvural

    #1

    Broken Library Code, suggested course of action

    I've been trying to use the URLParse library, and I thought I had all
    of the kinks worked out when I ran into this:

    Traceback (most recent call last):
    File "./run.py", line 130, in ?
    main()
    File "./run.py", line 126, in main
    r = crawl.crawl(p, x)
    File "/home/monvural/src/crawl.py", line 74, in crawl
    root = parser.legiturl (url)
    File "/home/monvural/src/crawl.py", line 22, in legiturl
    t = urlparse.urlpar se(url)
    File "/usr/lib/python2.4/urlparse.py", line 50, in urlparse
    tuple = urlsplit(url, scheme, allow_fragments )
    File "/usr/lib/python2.4/urlparse.py", line 89, in urlsplit
    i = url.find(':')
    AttributeError: 'tuple' object has no attribute 'find'

    I have just recently upgraded my system to FC6, and I wasn't sure if
    this was an issue of version change. Why does the urlsplit() function
    work on my old station, but here I'm getting a tuple cannot find
    error. I understand from looking at the docs that tuples cannot have
    operations done onto them as they are immutable and sans index, but
    there has to be a way to dive into the http address and parse what's
    there. Thanks for any suggestions,

    --Melih Onvural

  • Bruno Desthuilliers

    #2
    Re: Broken Library Code, suggested course of action

    Melih Onvural a écrit :
    I've been trying to use the URLParse library, and I thought I had all
    of the kinks worked out when I ran into this:
    >
    Traceback (most recent call last):
    File "./run.py", line 130, in ?
    main()
    File "./run.py", line 126, in main
    r = crawl.crawl(p, x)
    File "/home/monvural/src/crawl.py", line 74, in crawl
    root = parser.legiturl (url)
    File "/home/monvural/src/crawl.py", line 22, in legiturl
    insert this line here:
    print "url : ", url, type(url)
    t = urlparse.urlpar se(url)
    File "/usr/lib/python2.4/urlparse.py", line 50, in urlparse
    tuple = urlsplit(url, scheme, allow_fragments )
    File "/usr/lib/python2.4/urlparse.py", line 89, in urlsplit
    i = url.find(':')
    AttributeError: 'tuple' object has no attribute 'find'
    I guess you'll find that you pass a tuple instead of a string.

    Comment

    Working...