ich probiere schon seit Stunden den Fehler in meinem Quelltext zu finden, leider ohne Erfolg. Ich erhalte immer wieder folgende Fehlermeldung:
'ascii' codec can't encode character u'\xdf' in position 70: ordinal not in range(128)
Code: Alles auswählen
for products in Product.objects.all():
category_path = ''
category_utm = ''
categories = products.get_categories()
if len(categories) > 0 :
category = categories[0]
if category.slug in filter_category:
objects = []
while category is not None:
objects.append(category)
category = category.parent
for parent in objects:
category_path = category_path + '/' + str(parent.name.encode('utf-8'))
category_utm = category_utm + '--' + str(parent.slug)
#prices
if products.for_sale == True :
price = products.for_sale_price
else :
price = products.price
#productdescription
description = products.meta_description
description = description.replace("\n", "")
description = description.replace("\r", "")
#deeplink
product_path = ''
deeplink = product_path + products.get_absolute_url()
#image
image_path = ''
imagelink = image_path + products.get_image().url_200x200
shipinfo = 'ab Lager'
if products.is_product_with_variants():
bline = []
elif products.is_variant():
vline = []
#variant description
vdescription = products.get_meta_description()
if vdescription != '' :
vdescription = vdescription.replace("\n", "")
vdescription = vdescription.replace("\r", "")
vdescription = vdescription.replace("%P", description)
description = vdescription
vline.extend([
products.id,
products.name.encode('utf-8'),
category_path.encode('utf-8'),
price,
deeplink,
'',
description.encode('utf-8'),
shipinfo,
0,
imagelink
])
if price > 0 :
writer.writerow(vline)
elif products.is_standard():
line = []
line.extend([
products.id,
products.name.encode('utf-8'),
category_path.encode('utf-8'),
price,
deeplink,
'',
description.encode('utf-8'),
shipinfo,
0,
imagelink
])
if price > 0 :
writer.writerow(line)
Könnt ihr mir weiterhelfen?