Reputation: 21
Question No changes to this module that I am aware of. Another separate custom program was installed on the same computer then the errors below started.
Suggestions would be appreciated.
Errors 3
Traceback (most recent call last):
File "log.py", line 100, in error_catcher response = func()
File "models.py", line 852, in func instance.main()
File "models.py", line 1061, in main data_obj = report.Main(*self.args)
File "report.py", line 95, in init self.data_manager()
File "report.py", line 113, in data_manager self.equivdod_report('DoD Equiv')
File "report.py", line 328, in equivdod_report datas)
File "scriptexcel.py", line 230, in equivdod_report ytitle=r'Design Usage (%)'
File "excelcreator.py", line 376, in hist__init__ self.title_params(bc.title)
File "excelcreator.py", line 767, in title_params baseline=1000
AttributeError: 'list' object has no attribute 'rPr'
excelcreator.py (Segments from this module)
from openpyxl import Workbook
from openpyxl import load_workbook
from openpyxl.chart.title import Title
import openpyxl.drawing.text as oxldt
import os
import re
import openpyxl
import numpy as np
import datetime
class Excel():
def hist__init__(self,
sheet_name,
mincol=None,
maxcol=None,
minrow=None,
maxrow=None,
bc=None,
title=None,
ytitle=None,
xtitle=None):
if bc is None:
bc = BarChart()
bc.title = title
bc.y_axis.title = ytitle
bc.legend.position = 't'
self.title_params(bc.title)
self.title_params(bc.y_axis.title)
xval = Reference(
self.wb[sheet_name],
min_col=mincol-1,
min_row=2,
max_row=maxrow)
data = Reference(
self.wb[sheet_name],
min_col=mincol,
max_col=maxcol,
min_row=minrow,
max_row=maxrow)
return bc, xval, data
def title_params(self, title):
if title is not None:
title.tx.rich.p[0].r.rPr = CharacterProperties(
latin=oxldt.Font(typeface='Arial'),
baseline=1000
)
Upvotes: 0
Views: 754
Reputation: 21
As per answer from Charlie Clark this resolved the issue:
p[0].r changed to p[0].r[0].rPr
Upvotes: 1
Reputation: 19507
p[0].r
is a list. You might want to try p[0].r[0].rPr
Look at the source code for chart titles or the OOXML specification schema for more information.
Upvotes: 2