2013-05-02 90 views
1

我爲我的項目創建了一個.spec文件,PyInstaller運行順暢。但是,在運行.exe文件,我的裝載機打嗝有以下:PyInstaller找不到數據文件

Traceback (most recent call last): 
    File "<string>", line 14, in <module> 
    File "../../pyinstaller-2.0\PyInstaller\loader\iu.py", line 386, in importHook 

    File "../../pyinstaller-2.0\PyInstaller\loader\iu.py", line 480, in doimport 
    File "C:\Users\Spencer\workspace\nifty-prose-articulator\build\pyi.win32\Nifty 
Prose Articulator\out00-PYZ.pyz\src.gui.main_window", line 25, in <module> 
    File "../../pyinstaller-2.0\PyInstaller\loader\iu.py", line 386, in importHook 

    File "../../pyinstaller-2.0\PyInstaller\loader\iu.py", line 480, in doimport 
    File "C:\Users\Spencer\workspace\nifty-prose-articulator\build\pyi.win32\Nifty 
Prose Articulator\out00-PYZ.pyz\src.docx", line 15, in <module> 
IOError: [Errno 2] No such file or directory: 'C:\\Users\\Spencer\\workspace\\ni 
fty-prose-articulator\\build\\pyi.win32\\Nifty Prose Articulator\\out00-PYZ.pyz\ 
\OMMLToMathML.xsl' 

而且它指的是XSLT,我還需要在運行在其它的XML文件來加載。

這裏是我的.spec文件:

a = Analysis(['src/main.py'], 
      pathex=['C:\\Users\\Spencer\\workspace\\nifty-prose-articulator'], 
      hiddenimports=[], 
      hookspath=None) 

pyz = PYZ(a.pure) 
exe = EXE(pyz, 
      a.scripts, 
      exclude_binaries=1, 
      name=os.path.join('build\\pyi.win32\\Nifty Prose Articulator', 'Nifty Prose Articulator.exe'), 
      debug=False, 
      strip=None, 
      upx=True, 
      console=True) 
coll = COLLECT(exe, 
       a.binaries, 
       a.zipfiles, 
       a.datas + [('OMMLToMathML.xsl', 'C:\\Users\\Spencer\\workspace\\nifty-prose-articulator\\src\\docx\\OMMLToMathML.xsl', 'DATA')] , 
       Tree(os.path.abspath('src/forms/icons')), 
       Tree(os.path.abspath('src/docx')), 
       strip=None, 
       upx=True, 
       name=os.path.join('dist', 'Nifty Prose Articulator')) 
app = BUNDLE(coll, 
      name=os.path.join('dist', 'Nifty Prose Articulator.app')) 

OMMLToMathML.xsl裏面C:\Users\Spencer\workspace\nifty-prose-articulator\src\docx

該.spec在C:\Users\Spencer\workspace\nifty-prose-articulator\Nifty Prose Articulator.spec

我用來創建.exe文件的命令是這樣的:python ../../pyinstaller-2.0/utils/Build.py "Nifty Prose Articulator.spec"

正如你所看到的,我已經試過單獨添加文件,並通過它含蓄地使用添加Tree(其中也有一些其他數據文件) 。

我一定在做錯事,但我一直在這個問題上打了太久。在此先感謝您的幫助!

回答

0

原來,那個特定的樣式表來自我忘記刪除的一些棄用代碼。其他一切正常。