我一直在開發一個應用程序,它使用wxPython作爲GUI庫和py2exe,以便我可以輕鬆分發它,但是我剛纔測試了py2exe和啓動可執行文件時出現以下錯誤。wxPython和py2app,CreateActCtx錯誤0x00000008(沒有足夠的磁盤空間可用)
12:13:08: Debug: src/helpers.cpp(140): 'CreateActCtx' failed with error 0x00000008 (Not enough disk space available.).
Traceback (most recent call last):
File "eYoutubeMacros3.py", line 1, in <module>
File "zipextimporter.pyo", line 82, in load_module
File "application\application.pyo", line 5, in <module>
File "zipextimporter.pyo", line 82, in load_module
File "application\backend\backend.pyo", line 4, in <module>
File "zipextimporter.pyo", line 82, in load_module
File "application\backend\extractor.pyo", line 5, in <module>
File "zipextimporter.pyo", line 82, in load_module
File "twisted\web\client.pyo", line 17, in <module>
File "zipextimporter.pyo", line 82, in load_module
File "twisted\web\error.pyo", line 188, in <module>
ImportError: cannot import name resource
導致錯誤的src/helpers.cpp功能是
static ULONG_PTR wxPySetActivationContext()
{
OSVERSIONINFO info;
wxZeroMemory(info);
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&info);
if (info.dwMajorVersion < 5)
return 0;
ULONG_PTR cookie = 0;
HANDLE h;
ACTCTX actctx;
TCHAR modulename[MAX_PATH];
GetModuleFileName(wxGetInstance(), modulename, MAX_PATH);
wxZeroMemory(actctx);
actctx.cbSize = sizeof(actctx);
actctx.lpSource = modulename;
actctx.lpResourceName = MAKEINTRESOURCE(2);
actctx.hModule = wxGetInstance();
actctx.dwFlags = ACTCTX_FLAG_HMODULE_VALID | ACTCTX_FLAG_RESOURCE_NAME_VALID;
h = CreateActCtx(&actctx);
if (h == INVALID_HANDLE_VALUE) {
wxLogLastError(wxT("CreateActCtx"));
return 0;
}
if (! ActivateActCtx(h, &cookie))
wxLogLastError(wxT("ActivateActCtx"));
return cookie;
}
而且最後我對py2exe代碼
setup(
console = [self.target], # Contains some build info, is this is relevant I'll add it
zipfile = 'library.dat',
options = {
'py2exe' : {
'bundle_files' : 1,
'dll_excludes' : ['w9xpopen.exe'],
'optimize' : 2,
'dist_dir' : '../dist/executables/',
'compressed' : True,
#'excludes' : ['doctest', 'pdb', 'unittest', 'difflib', 'inspect'],
}
}
)
編輯:是第二個錯誤似乎是從扭曲但我懷疑這會導致第一個錯誤。 Edit2:嗯,也許第一個只是一個警告。
是你能夠嘗試我給出的解決方案。 – pyfunc 2010-09-01 16:49:55