views:

67

answers:

2

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' : {
            'bundle_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.

+1  A: 

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

pyfunc
I had to explicitly include the resource class and that made it start normally. Now all I need to do is figure out why the app looks like it's running on win98. The manifest embedding somehow crashes it even with the DLLs in place.
Xeross
Do you include crt dlls too. See http://msdn.microsoft.com/en-us/library/ms235291.aspx
pyfunc
A: 

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

Xeross