arkpoah
arkpoah

Reputation: 1

Include folder with py2exe

I use python-pptx package for my script. 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 :

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. If I add manually this folder in library.zip, I get same error.

How can I tell to py2exe to take this folder ?

Upvotes: 0

Views: 1171

Answers (1)

user3117369
user3117369

Reputation: 11

Solved the problem.

Copy the folder \pptx\templates\default.pptx in your project, and when you create the pptx use this form:

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

Upvotes: 1

Related Questions