开发者

wxPython and py2app, CreateActCtx error 0x00000008 (Not enough disk space available)

开发者 https://www.devze.com 2023-01-14 01:10 出处:网络
I\'ve been developing an application that uses wxPython as the GUI librar, and py2exe so that I can easily distribute it, however I have just now tested py2exe and the following error appears when the

I've been developing an application that uses wxPython as the GUI librar, and py2exe so that I can easily distribute it, however I have just now tested py2exe and the following error appears when the executable is launched.

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

The function causing the error in src/helpers.cpp is

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;
}

And lastly my code for py2exe

setup(
    console = [self.target], # Contains some build info, is this is relevant I'll add it
    zipfile = 'library.dat',
    options = {
        'py2exe' : {
            'b开发者_JAVA技巧undle_files' : 1,
            'dll_excludes' : ['w9xpopen.exe'],
            'optimize'     : 2,
            'dist_dir'     : '../dist/executables/',
            'compressed'   : True,
            #'excludes'     : ['doctest', 'pdb', 'unittest', 'difflib', 'inspect'],
        }
    }
)

Edit: Yes the second error seems to be from twisted but I doubt that causes the first error. Edit2: Hmm perhaps the first one is just a warning.


That means common controls stuff does not load. The second error could be a result of the first error which is non fatal and program continues to run.

try first :

(Don't bundle option) and check if the issue still appears. This should typically work.

bundle_files = 3 

try next:

Since, you are using bundle option 1 , Can you check which MSVC runtime DLL is located in the dist directory along side the executable. I would suggest that you also find out all MSVCRXX.dll on your machine and see if there are version issues


Turned out #1 was just a warning, and #2 was fixed with an explicit module include

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号