Issues while installing connecting a db

hello dear linux-experts

well this is somewhat difficult - why do i get these results!!?`

here the original posting

fairly new to python and to programming too.

I’m trying to connect to a MySQL database using peewee and I can’t get
it to work. I’m new to databases so I’m probably doing something stupid,
but this is what I’m trying: well i tried to get connection to a
database in python with peewee but at a certain point the programme
fails.

[CODE]import urllib
import urlparse
import re

import peewee

import json
from peewee import *
#from peewee import MySQLDatabase (‘cpan’, user=‘root’,passwd=‘rimbaud’)
db = MySQLDatabase(‘cpan’, user=‘root’,passwd=‘rimbaud’)

class User(Model):
name = TextField()
cname = TextField()
email = TextField()
url = TextField()

class Meta:
    database = db # this model uses the cpan database

User.create_table() #ensure table is created

url = “http://search.cpan.org/author/?W
html = urllib.urlopen(url).read()
for lk, capname, name in re.findall(‘(.?)
(.
?)’, html):
alk = urlparse.urljoin(url, lk)
data = { ‘url’:alk, ‘name’:name, ‘cname’:capname }
phtml = urllib.urlopen(alk).read()
memail = re.search(‘’, phtml)
if memail:
data[‘email’] = memail.group(1)

data = json.load(‘email’) #your json data file here

for entry in data: #assuming your data is an array of JSON objects
user = User.create(name=entry[“name”], cname=entry[“cname”],
email=entry[“email”], url=entry[“url”])
user.save()[/CODE]

the results:i am faded

martin@linux-70ce:~/perl> python cpan_100.py Traceback (most recent call last): File "cpan_100.py", line 45, in <module> user = User.create(name=entry["name"], cname=entry["cname"], TypeError: string indices must be integers, not str

well at the moment i wonder why i run into there errors