Python error when retrieving a url from a database and opening it with webbrowser()
Question: I am trying to make an app similar to StumbleUpon using Python as a back end
for a personal project . From the database I retrieve a website name and then
I open that website with webbrowser.open("http://www.website.com"). Sounds
pretty straight forward right but there is a problem. When I try to open the
website with webbrowser.open("website.com") it returns the following error:

    
    
    File "fetchall.py", line 18, in <module>
    webbrowser.open(x)
    File "/usr/lib/python2.6/webbrowser.py", line 61, in open
    if browser.open(url, new, autoraise):
    File "/usr/lib/python2.6/webbrowser.py", line 190, in open
    for arg in self.args]
    TypeError: expected a character buffer object
    

Here is my code:

    
    
    import sqlite3
    import webbrowser 
    
    conn = sqlite3.connect("websites.sqlite")
    
    cur = conn.cursor()
    
    cur.execute("SELECT WEBSITE FROM COLUMN")
    
    x = cur.fetchmany(1)
    
    webbrowser.open(x)
    

EDIT

Okay thanks for the reply, but now I'm receiving this: "Error showing URL:
Error stating file '/home/user/(u'http:bbc.co.uk,)': No such file or
directory".

What's going on ?


Answer: `webbrowser.open` is expecting a character buffer, but `fetchmany` returns a
list. So `webbrowser.open(x[0])` should do the trick.

