Мне не удается сохранить книги, когда я применяю форматирование к листу (например, задаю для параметра row_dimensions целое число или для размеров столбца целое число).
Фрагмент кода:
import openpyxl
wb = openpyxl.Workbook()
ws = wb.active
ws['A1'].value = 'test'
ws.row_dimensions[1] = 10
wb.save('example.xlsx')
Информация трассировки:
Traceback (most recent call last):
File "<>", line 7, in <module>
wb.save('practicewb')
File "C:\Program Files (x86)\Python37-32\lib\site-packages\openpyxl\workbook\workbook.py", line 409, in save
save_workbook(self, filename)
File "C:\Program Files (x86)\Python37-32\lib\site-packages\openpyxl\writer\excel.py", line 294, in save_workbook
writer.save()
File "C:\Program Files (x86)\Python37-32\lib\site-packages\openpyxl\writer\excel.py", line 276, in save
self.write_data()
File "C:\Program Files (x86)\Python37-32\lib\site-packages\openpyxl\writer\excel.py", line 76, in write_data
self._write_worksheets()
File "C:\Program Files (x86)\Python37-32\lib\site-packages\openpyxl\writer\excel.py", line 216, in _write_worksheets
self.write_worksheet(ws)
File "C:\Program Files (x86)\Python37-32\lib\site-packages\openpyxl\writer\excel.py", line 201, in write_worksheet
writer.write()
File "C:\Program Files (x86)\Python37-32\lib\site-packages\openpyxl\worksheet\_writer.py", line 356, in write
self.write_rows()
File "C:\Program Files (x86)\Python37-32\lib\site-packages\openpyxl\worksheet\_writer.py", line 124, in write_rows
self.write_row(xf, row, row_idx)
File "C:\Program Files (x86)\Python37-32\lib\site-packages\openpyxl\worksheet\_writer.py", line 133, in write_row
attrs.update(dims.get(row_idx, {}))
TypeError: 'int' object is not iterable
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "C:\Program Files (x86)\Python37-32\lib\site-packages\openpyxl\worksheet\_writer.py", line 33, in _openpyxl_shutdown
os.remove(path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\philt\\AppData\\Local\\Temp\\openpyxl.gtzivgcp'
Process finished with exit code 1
У меня нет открытых папок или программ, использующих рабочую книгу, кроме самого openpyxl.
В чем может быть проблема?
Спасибо!