Calc crashes when opening auto-generated spreadsheets

In Linux (CentOS/KDE), if I generate spreadsheets through a python script, and then attempt to open the spreadsheet, I get the following error:

> libreoffice5.1 hello_world.xlsx
QObject::connect: Cannot queue arguments of type 'css::uno::Reference<css::uno::XComponentContext>'
(Make sure 'css::uno::Reference<css::uno::XComponentContext>' is registered using qRegisterMetaType().)
QPixmap: It is not safe to use pixmaps outside the GUI thread
QPixmap: It is not safe to use pixmaps outside the GUI thread
QPixmap: It is not safe to use pixmaps outside the GUI thread

I have tried using the simplest of possible scripts from both “xlsxwriter” and “openpyxl”. Both fail in the same way. In fact, I resorted to copying the “hello world” examples from the two projects, and executing them with no change.

The error/crash happens if I save the file in any of these formats: .xlsx, .xls, .ods

If I send the same spreadsheets to my Mac running Microsoft Excel, they can be opened fine.

Here is my system details:
OS: Linux 2.6.32-431.el6.x86_64 x86_64
System: CentOS release 6.5
Window Manager: KDE 4.3.4
Libreoffice ver: LibreOffice 5.1.1.3 89f508ef3ecebd2cfb8e1def0f0ba9a803b88a6d
python ver: 3.5.1

I will also copy the actual scrips that generate the spreadsheets below. But these are exact copies of the simplest (hello world) starter scripts from each project:

##############################################################################
#
# A hello world spreadsheet using the XlsxWriter Python module.
#
# Copyright 2013-2016, John McNamara, jmcnamara@cpan.org
#
import xlsxwriter
workbook = xlsxwriter.Workbook('hello_world.xlsx')
worksheet = workbook.add_worksheet()
worksheet.write('A1', 'Hello world')
workbook.close()


from openpyxl import Workbook
wb = Workbook()
# grab the active worksheet
ws = wb.active
# Data can be assigned directly to cells
ws['A1'] = 42
# Rows can also be appended
ws.append([1, 2, 3])
# Python types will automatically be converted
import datetime
ws['A2'] = datetime.datetime.now()
# Save the file
wb.save("sample.xlsx")

I found one other detail about this crash. I have access to an older version of LibreOffice (3.4.5), running on a similar CentOS, and it does NOT crash when opening these spreadsheets.