[ python-Bugs-1601607 ] using python extension(wxPython) in c

SourceForge.net noreply at sourceforge.net
Thu Nov 23 19:02:10 CET 2006


Bugs item #1601607, was opened at 2006-11-23 09:52
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1601607&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Extension Modules
Group: Python 2.4
>Status: Closed
>Resolution: Invalid
Priority: 5
Private: No
Submitted By: jolleydtan (jolleydtan)
Assigned to: Nobody/Anonymous (nobody)
Summary: using python extension(wxPython) in c 

Initial Comment:
hello,all.
     i am confronting with a weird problem, almost forcing to die,the feeling is miserable, so pls help me.
here is a python application named "helloWorld",a simple gui application, assisted with wxPython.
from wxPython.wx import *
class myApp(wxApp):
      def OnInit(self):
            frame = wxFrame(NULL,-1,"hello,world!");
            frame.Show(true)
            self.SetTopWindow(frame)
            return true
app = myApp()
app.MainLoop()

also sorry for my unsmart code, which i should import wx not wxPython.wx.

and i want to use the simplest way to combine with c.so i use:
#include "python.h"
#include "wx/wxPython/wxPython.h"
#include <iostream>
using namespace std;

int main()
{
  Py_Initialize();
  if(!Py_IsInitialized())
  {
    cerr << "hello,world!"<< endl;
    return -1;
  }
  PyRun_SimpleString("from wxPython.wx import *");
  PyRun_SimpleString("class myApp(wxApp):");
  PyRun_SimpleString("     def OnInit(self):");
  PyRun_SimpleString("          frame = wxFrame(NULL,-1,"hello,world!")");
  PyRun_SimpleString("          frame.Show(true)");
  PyRun_SimpleString("          self.SetTopWindow(frame)");
  PyRun_SimpleString("          return true");
  PyRun_SimpleString("app = myApp()");
  PyRun_SimpleString("app.MainLoop()");
  Py_Finalize();
  return 0;
}
in addition, to make this work, i have configure something like this:
add the wxpython include/library files in vc.
includes:
c:\wxPython-src-2.6.3.3\wxPython\include.
c:\python24\include\wx(it is the product of building wxPython)
also the python include here.
c:\python24\include
libraries:
c:\wxPython-src-2.6.3.3\lib\vc_dll(the build product of wxWidgets)
c:\wxPython-src-2.6.3.3\wxPython\wxPython
c:\python24\libs
to supplement the problem, i install wxPython from source code,and i have gotten three files,all of which will be uploaded here.

and both them can pass the build process,but get "detected memory leaks  and dump objects"in the run process.
i figure that it has great memory leaks when loading certain symbols,like wxmsw26ud.lib or such,while other lib are not loaded "no symbol loaded!"

but i donot know why, and donot know how to build a wxPython script within c.
here is the error message:
Detected memory leaks!
Dumping objects ->
{6417} normal block at 0x01B72B30, 262144 bytes long.
 Data: <                > CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD 
{6339} normal block at 0x01B0A9C8, 480 bytes long.
 Data: <        @_      > 00 00 01 D0 FB FB FB FB 40 5F AD 01 20 92 AD 01 
{6338} normal block at 0x01B0A7D0, 440 bytes long.
.....
{48} normal block at 0x003F2C88, 64 bytes long.
 Data: <h       h       > 68 00 A4 00 08 20 A9 00 68 00 B4 00 B8 11 B8 00 
{47} normal block at 0x00A40068, 262144 bytes long.
 Data: <                > CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD 
{45} normal block at 0x003F4F10, 12 bytes long.
 Data: <            > FF FF FF FF 00 00 00 00 C0 07 00 00 
Object dump complete.
The thread 'Win32 Thread' (0x9ec) has exited with code 0 (0x0).
The program '[2960] wxPythonGUI.exe: Native' has exited with code 0 (0x0).

thanks one billion times if someone can tell me,coz the progress should be advanced further.and all my other people awaits it.
regards,
jolley.d.tan








----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2006-11-23 19:02

Message:
Logged In: YES 
user_id=21627
Originator: NO

Please don't use the bug tracker as a means to get support; it is not
meant to be used that way.
Instead, try to get help e.g. on news:comp.lang.python

I can see various errors in your code; as a starting point, check the
result of PyRun_SimpleString.

Closing the report as invalid.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1601607&group_id=5470


More information about the Python-bugs-list mailing list