Подскажите не как не могу понять как эту ошибку исправить. Произвожу работу на python 2.7.11 с excel под win7.
# -*- coding: cp1251 -*-
import openpyxl
wb = openpyxl.load_workbook(filename='1.xlsx')
sheet = wb["вася".decode('cp1251')]
val = sheet['A7'].value
sheet['A7'] = "Сергей".decode("cp1251")
wb.save("3.xlsx")
print val
ошибка:
C:\Python27\python.exe C:/Users/hi/PycharmProjects/untitled/main.py
Traceback (most recent call last):
File "C:/Users/hi/PycharmProjects/untitled/main.py", line 7, in
wb.save("3.xlsx")
File "C:\Users\hi\PycharmProjects\untitled\openpyxl\workbook\workbook.py", line 294, in save
save_workbook(self, filename)
File "C:\Users\hi\PycharmProjects\untitled\openpyxl\writer\excel.py", line 270, in save_workbook
writer.save(filename)
File "C:\Users\hi\PycharmProjects\untitled\openpyxl\writer\excel.py", line 251, in save
self.write_data()
File "C:\Users\hi\PycharmProjects\untitled\openpyxl\writer\excel.py", line 94, in write_data
archive.writestr(ARC_WORKBOOK, write_workbook(self.workbook))
File "C:\Users\hi\PycharmProjects\untitled\openpyxl\writer\workbook.py", line 133, in write_workbook
for r in sheet.print_area])
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)