I've a Python file titled my_python_file.py
that makes, among other things, a .doc
file using the python-docx
module. The .doc
is created perfectly and gives no problem. The problem comes when I build a .exe
of my script and I try to make the .doc
. An AssertionError
problem appears.
This is my exe maker code (exe_maker.py
):
from distutils.core import setup
import py2exe, sys, os
sys.argv.append('py2exe')
setup(
options = {'py2exe': {'bundle_files': 3, 'compressed': True, 'includes': ['lxml.etree', 'lxml._elementpath', 'gzip', 'docx']}},
windows = [{'script': "my_python_file.py"}],
zipfile = None,
)
It seems that moving the python script to a different location produces the error.
File "docx.pyc", line 1063, in savedocx
AssertionError
This is the savedocx
line:
document = newdocument()
[...]
coreprops = coreproperties(title=title, subject=subject, creator=creator, keywords=keywords)
approps = appproperties()
contenttypes2 = contenttypes()
websettings2 = websettings()
wordrelationships2 = wordrelationships(relationships)
path_save = "C:\output"
savedocx(document, coreprops, approps, contenttypes2, websettings2, wordrelationships2, path_save)
The savedox
is well writen as it works when it's not an .exe
file.
How can I make the docx
module work correctly? Do I've to add any other path/variable more when I make the exe?
Thanks in advance