Search code examples
pythonmysqlscraper

Any help on cursor.execute and urljoin?


I'm getting:

exceptions.TypeError: not all arguments converted during string formatting

from this:

cursor.execute("SELECT * FROM `item` WHERE `url` = %s", (urljoin( base_url, item_url ) ))

Syntax seems fine - any ideas?


Solution

  • The issue here is you are passing in a string, where you should be passing in a tuple. Note the extra comma at the end:

    execute("SELECT * FROM `item` WHERE `url` = %s", (urljoin(base_url, item_url),))