Are you building your code as a unicode application? In Python 3.3, the
"TCHAR" will actually be unicode. If you do roll back to python 2.x, it
will be a regular "char *".
Mark
On 2/04/2012 2:04 AM, Maggard, Eric wrote:
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
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32