I've got a script that uses com to read columns from an excel workbook(very
slow for 6500ish items :/ ) and I'm getting this error:
'ascii' codec can't encode character u'\xa0' in position 11: ordinal not in
range(128)
Error with: FRAMEMRISER of type: <type 'unicode'>
Excel Row : 6355
FRAMEMRISER is exactly how the item looks in excel. What I don't get is why
it prints to my screen fine, but I can't get the darn thing to convert to a
string. I think xa0 is a space (like ' '), which location 11 puts it at
the end of the of the word, basically invisible. I've successfully used my
script to import several columns, but this one is being a pain.
My code in question:
try:
while xlSht.Cells(row,col).Value != None:
tempValue = xlSht.Cells(row,col).Value
tempString = str(tempValue).split('.')[0]
ExcelValues.append(tempString)
Row = 1 + row # Increment Rows.
except UnicodeEncodeError, msg: # Exit the system if error.
print msg
print "Error with: " + tempValue + " of type: " +
str(type(tempValue))
print "Excel Row : " + str(row)
Thanks in advance.
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor