Skip to content

CI: styled excel failure in the doc build #29854

Closed
@jorisvandenbossche

Description

@jorisvandenbossche

CI is failing in the doc build (eg https://dev.azure.com/pandas-dev/pandas/_build/results?buildId=21689&view=logs), with the following error related to excel:

>>>-------------------------------------------------------------------------
Exception in /home/vsts/work/1/s/doc/source/whatsnew/v0.20.0.rst at block ending on line None
Specify :okexcept: as an option in the ipython:: block to suppress this message
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-51-dde24f57e06d> in <module>
----> 1 styled.to_excel('styled.xlsx', engine='openpyxl')

~/work/1/s/pandas/io/formats/style.py in to_excel(self, excel_writer, sheet_name, na_rep, float_format, columns, header, index, index_label, startrow, startcol, engine, merge_cells, encoding, inf_rep, verbose, freeze_panes)
    232             startcol=startcol,
    233             freeze_panes=freeze_panes,
--> 234             engine=engine,
    235         )
    236 

~/work/1/s/pandas/io/formats/excel.py in write(self, writer, sheet_name, startrow, startcol, freeze_panes, engine)
    742         )
    743         if need_save:
--> 744             writer.save()

~/work/1/s/pandas/io/excel/_openpyxl.py in save(self)
     42         Save workbook to disk.
     43         """
---> 44         return self.book.save(self.path)
     45 
     46     @classmethod

~/miniconda3/envs/pandas-dev/lib/python3.7/site-packages/openpyxl/workbook/workbook.py in save(self, filename)
    406         if self.write_only and not self.worksheets:
    407             self.create_sheet()
--> 408         save_workbook(self, filename)
    409 
    410 

~/miniconda3/envs/pandas-dev/lib/python3.7/site-packages/openpyxl/writer/excel.py in save_workbook(workbook, filename)
    291     archive = ZipFile(filename, 'w', ZIP_DEFLATED, allowZip64=True)
    292     writer = ExcelWriter(workbook, archive)
--> 293     writer.save()
    294     return True
    295 

~/miniconda3/envs/pandas-dev/lib/python3.7/site-packages/openpyxl/writer/excel.py in save(self)
    273     def save(self):
    274         """Write data into the archive."""
--> 275         self.write_data()
    276         self._archive.close()
    277 

~/miniconda3/envs/pandas-dev/lib/python3.7/site-packages/openpyxl/writer/excel.py in write_data(self)
     73             archive.writestr(ARC_THEME, theme_xml)
     74 
---> 75         self._write_worksheets()
     76         self._write_chartsheets()
     77         self._write_images()

~/miniconda3/envs/pandas-dev/lib/python3.7/site-packages/openpyxl/writer/excel.py in _write_worksheets(self)
    213 
    214             ws._id = idx
--> 215             self.write_worksheet(ws)
    216 
    217             if ws._drawing:

~/miniconda3/envs/pandas-dev/lib/python3.7/site-packages/openpyxl/writer/excel.py in write_worksheet(self, ws)
    198         else:
    199             writer = WorksheetWriter(ws)
--> 200             writer.write()
    201 
    202         ws._rels = writer._rels

~/miniconda3/envs/pandas-dev/lib/python3.7/site-packages/openpyxl/worksheet/_writer.py in write(self)
    352         High level
    353         """
--> 354         self.write_top()
    355         self.write_rows()
    356         self.write_tail()

~/miniconda3/envs/pandas-dev/lib/python3.7/site-packages/openpyxl/worksheet/_writer.py in write_top(self)
     96         cols
     97         """
---> 98         self.write_properties()
     99         self.write_dimensions()
    100         self.write_views()

~/miniconda3/envs/pandas-dev/lib/python3.7/site-packages/openpyxl/worksheet/_writer.py in write_properties(self)
     58     def write_properties(self):
     59         props = self.ws.sheet_properties
---> 60         self.xf.send(props.to_tree())
     61 
     62 

~/miniconda3/envs/pandas-dev/lib/python3.7/site-packages/openpyxl/worksheet/_writer.py in get_stream(self)
    292                             continue
    293                         else:
--> 294                             xf.write(el)
    295                 except GeneratorExit:
    296                     pass

src/lxml/serializer.pxi in lxml.etree._IncrementalFileWriter.write()

TypeError: got invalid input value of type <class 'xml.etree.ElementTree.Element'>, expected string or Element
<<<-------------------------------------------------------------------------

Comparing the last working build (https://dev.azure.com/pandas-dev/pandas/_build/results?buildId=21675) with the first failing (https://dev.azure.com/pandas-dev/pandas/_build/results?buildId=21689) on master, there is a change in openpyxl version (30.01 -> 3.0.2), which might be the cause.
(also pandoc 2.7.3 -> 2.8, but don't think that can be related)

Metadata

Metadata

Assignees

No one assigned

    Labels

    CIContinuous IntegrationIO Excelread_excel, to_excel

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions