[python-win32] [pywin32 extensions] Traceback error on running startup script

Maggard, Eric eric.maggard at hp.com
Sun Apr 1 18:04:34 CEST 2012


Hi,

I am working on a Win7 machine (64-bit), but would like to embed pywin into a 32-bit MFC app.  I downloaded the 217 build for python 3.2 and then downloaded the python-3.2.2.msi install package.  I installed python and then installed the pywin32 extensions.  I also downloaded the source files pywin32-217.zip and successfully built the pythonwin application.  I made sure I downloaded the 32 bit versions to match my application I am embedding into.

I followed the embedding guild: http://tgolden.sc.sabren.com/pywin32-docs/html/pythonwin/doc/EmbeddingWin32ui.html and then also looked at your pythonwin application files.

When I start mu application, I am getting a traceback error when the function Win32uiHostGlue::DynamicApplicationInit is executing the following line:
      rc = (*pfnWin32uiInit)(this, (TCHAR *)cmd, (TCHAR *)additionalPaths);

The error that it is showing is:
      tuple: ('invalid syntax', ('<string>', 1, 1, '??????????????????????\x0f\n'))

I have tried to pass a CString, string, CString.GetString(), and string.c_str() and the traceback error changes slightly, but I always get the error. I am thinking python is not parsing the command string correctly.

I copied the pythonwin directly under the build directory I did to my application directory.  I traced the steps leading up to that line and it seems python is getting initialized correctly.  I can start the pythonwin application that is included under the build directory... so, I know it should be working.

Here is the initialization I am using:
      CString startup = "import pywin.framework.startup";

      // Check for theGlue Initialization
      if (!theGlue.DynamicApplicationInit(startup)) {
            AfxMessageBox("Could not attach to the Python win32ui extensions.");
//          return FALSE;
      }
      else
            AfxMessageBox("Python initialized");

If I can't get this working, then I am thinking about removing the 3.2 version and trying the 3.1 or the 2.7 versions.

Thanks for your help,
Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20120401/4ddcf04c/attachment.html>


More information about the python-win32 mailing list