my_python_file.py
이라는 제목의 파이썬 파일을 가지고 있는데, 특히 python-docx
모듈을 사용하는 .doc
파일이 있습니다. .doc
은 완벽하게 생성되며 아무런 문제가 없습니다. 문제는 내 스크립트의 .exe
을 빌드하고 .doc
을 만들려고 할 때 발생합니다. AssertionError
문제가 나타납니다..exe가 생성 될 때 AsserionError를 제공하는 Python의 docx 모듈
이 내 EXE 메이커 코드 (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,
)
다른 위치로 파이썬 스크립트를 이동하면 오류가 발생합니다 것으로 보인다. 그것이 .exe
파일이 아닙니다 때 작동으로
savedox
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)
잘 writen된다
File "docx.pyc", line 1063, in savedocx
AssertionError
이것은 savedocx
라인입니다.
docx
모듈을 올바르게 작동 시키려면 어떻게해야합니까? exe를 만들 때 다른 경로/변수를 더 추가해야합니까? 사전
AssertionError를 발생시키는 행은 무엇입니까? 또한 코드는 GitHub에 있거나 어딘가에서 검사 할 수 있습니까? 여기에 가야 할 것이별로 없습니다. 또한 post-Word 2007 파일에는 이전 .doc 확장자가 아닌'.docx' 확장자가 주어집니다. 또한 PIL 또는 Pillow가 종속성 목록에없는 것을 확인합니다. – scanny
'savedoc'의 줄을 추가했지만 질문에서'.exe'가 빌드되지 않을 때 완벽하게 작동하므로'savedoc' 줄의 프로그래밍 문제가 아닙니다. 미리 감사드립니다. –
필자는''ncludes'' 행에'PIL'을 추가했으나 작동하지 않습니다. –