简体   繁体   English

包含py2exe文件夹

[英]Include folder with py2exe

I use python-pptx package for my script. 我的脚本使用python-pptx包。 This package has a subfolder like that 这个软件包有一个类似的子文件夹

pptx/
     templates/
               default.pptx
     py files

I use py2exe to generate a windows executable, but when I execute it I get this error which explains that the 'templates' directory is not put in the generated library.zip : 我使用py2exe生成Windows可执行文件,但是当我执行它时,出现此错误,这说明'templates'目录未放在生成的library.zip中:

pptx.exc.PackageNotFoundError: Package not found at 'C:\Documents and Settings\rke99878\Mes documents\pptx_fusion\dist\library.zip\pptx\templates\default.pptx'

python files for this package are well taken, but not this folder, I tried to add package={'pptx/*'} in py2exe options, but same issue. 这个软件包的python文件是很好用的,但是这个文件夹不是,我试图在py2exe选项中添加package = {'pptx / *'},但是同样的问题。 If I add manually this folder in library.zip, I get same error. 如果我在library.zip中手动添加此文件夹,则会收到相同的错误。

How can I tell to py2exe to take this folder ? 如何告诉py2exe接收此文件夹?

Solved the problem. 解决了问题。

Copy the folder \\pptx\\templates\\default.pptx in your project, and when you create the pptx use this form: 复制项目中的\\pptx\\templates\\default.pptx文件夹,并在创建pptx时使用以下格式:

prs = Presentation(r'C:\Documents and Settings\rke99878\Mes documents\pptx_fusion\dist\pptx\templates\default.pptx')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM