Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python cx“冻结/pptx”;PackageNotFoundError“;_Python_Python 2.7_Powerpoint_Cx Freeze - Fatal编程技术网

Python cx“冻结/pptx”;PackageNotFoundError“;

Python cx“冻结/pptx”;PackageNotFoundError“;,python,python-2.7,powerpoint,cx-freeze,Python,Python 2.7,Powerpoint,Cx Freeze,我正在开发一个使用模块“pptx”(编辑和操作powerpoint)的Python程序。该程序在解释器中正常工作,但一旦我将其作为.exe文件启动(使用cx_freeze或py2exe构建),单击主按钮时会出现以下错误消息: Exception in Tkinter callback Traceback (most recent call last): File "Tkinter.pyc", line 1470, in __call__ File "pptx_02.py", line 187,

我正在开发一个使用模块“pptx”(编辑和操作powerpoint)的Python程序。该程序在解释器中正常工作,但一旦我将其作为.exe文件启动(使用cx_freeze或py2exe构建),单击主按钮时会出现以下错误消息:

Exception in Tkinter callback
Traceback (most recent call last):
File "Tkinter.pyc", line 1470, in __call__
File "pptx_02.py", line 187, in ButtonErstellen
File "pptx\api.pyc", line 29, in __init__
File "pptx\presentation.pyc", line 87, in __init__
File "pptx\presentation.pyc", line 170, in __open
File "pptx\packaging.pyc", line 88, in open
File "pptx\packaging.pyc", line 671, in __new__
PackageNotFoundError: Package not found at 'C:\Users\Moi\Programmation\Python\build\exe.win32-2.7\library.zip\pptx\templates\default.pptx' 
问题是文件“default.pptx”实际上存在于该地址

在查看“pptx”的功能时,我可能对这个问题的原因有了想法(但不知道解决方案)。 最后一个错误:文件“pptx\packaging.pyc”,第671行,在新建
代码如下:

class FileSystem(object):
    """
    Factory for filesystem interface instances.

    A FileSystem object provides access to on-disk package items via their URI
    (e.g. ``/_rels/.rels`` or ``/ppt/presentation.xml``). This allows parts to
    be accessed directly by part name, which for a part is identical to its
    item URI. The complexities of translating URIs into file paths or zip item
    names, and file and zip file access specifics are all hidden by the
    filesystem class. |FileSystem| acts as the Factory, returning the
    appropriate concrete filesystem class depending on what it finds at *path*.
    """
    def __new__(cls, file):
        # if *file* is a string, treat it as a path
        if isinstance(file, basestring):
            path = file
            if is_zipfile(path):
                fs = ZipFileSystem(path)
            elif os.path.isdir(path):
                fs = DirectoryFileSystem(path)
            else:
                raise PackageNotFoundError("Package not found at '%s'" % path)
        else:
            fs = ZipFileSystem(file)
        return fs
问题可能是最终文件(default.pptx)不是zip,而是在zip中。但我不知道我该如何修复它,或者它是否真的是个问题

如果某人是一个想法


谢谢大家!

我认为你在这个问题上是对的。pptx不希望在zip文件中找到自己。您需要修改它,以便它能够以某种方式加载其模板。查看
演示文稿。默认路径可能是一个很好的起点。我在setup.py的“includefiles”和“package”中添加了库“pptx”,它终于起作用了。谢谢你的回答Tyrtamos()找到了解决方案我不完全确定如何找到,但我很高兴你解决了它;-)