Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 16th, 2012, 04:10 AM
gokulkumargopal gokulkumargopal is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 5 gokulkumargopal User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 32 m 54 sec
Reputation Power: 0
Segmentation Fault on click to open new frame

Hello,

I am beginner and this is my first post. Please bear with me if the information is not complete.

I have a written a small program to open a login window to input credentials to connect to oracle database.

Basically, I would like to display a login window on click of the New Connection button to read database credentials.

Here are the details..

OS Details:
-----------
gokul@gokul-VirtualBox:~/python_scripts$ cat /etc/*release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04 LTS"

Python Version: 2.7.3

Code:
import wx
import cx_Oracle

class PerfFrame(wx.Frame):
    def __init__(self,parent,title):
        frame = wx.Frame.__init__(self,parent,title=title)        
        
        self.CreateStatusBar()
        
        self.frame = frame
        # Menu Details
        perfmenu = wx.Menu()
        newcon = wx.MenuItem(perfmenu,wx.NewId(),"&New Connection","Opening a new connection")
        perfmenu.AppendItem(newcon)
        perfmenu.AppendSeparator()
        menuAbout = perfmenu.Append(wx.ID_ABOUT,"&About","Information about this program")
        perfmenu.AppendSeparator()
        menuExit = perfmenu.Append(wx.ID_EXIT,"E&xit","Exit the program")
        
        mainmenu = wx.MenuBar()
        mainmenu.Append(perfmenu,"Perf")
        self.SetMenuBar(mainmenu)

        self.Bind(wx.EVT_MENU, self.OnConn, newcon)
        self.Bind(wx.EVT_MENU, self.OnAbout, menuAbout)
        self.Bind(wx.EVT_MENU, self.OnExit, menuExit)     
        self.Show(True)

    def OnCloseWindow (self, event):
        self.Destroy()        

    def OnConn(self,event):
        AP_LoginPanel(self.frame,"Authentification required!")
        

    def OnAbout(self,event):
        dlg=wx.MessageDialog(self,"Open Source App to View AWR","About Performance Maintenance",wx.OK)
        dlg.ShowModal()
        dlg.Destroy()

    def OnExit(self,event):
        self.Close(True)

class AP_LoginPanel(wx.Frame):
    def __init__(self, parent, title):
        frame = wx.Frame.__init__(self,parent,title=title)
        self.panel = wx.Panel(frame)
        self.frame = frame

        self.showLoginBox()

    def showLoginBox (self):
  # Create the sizer
        sizer = wx.FlexGridSizer(rows=3, cols=2, hgap=5, vgap=15)

  # Username
        self.txt_Username = wx.TextCtrl(self.panel, 1, size=(150, -1))
        lbl_Username = wx.StaticText(self.panel, -1, "Username:")
        sizer.Add(lbl_Username,0, wx.LEFT|wx.TOP| wx.RIGHT, 50)
        sizer.Add(self.txt_Username,0, wx.TOP| wx.RIGHT, 50)

  # Password
        self.txt_Password = wx.TextCtrl(self.panel, 1, size=(150, -1), style=wx.TE_PASSWORD)
        lbl_Password = wx.StaticText(self.panel, -1, "Password:")
        sizer.Add(lbl_Password,0, wx.LEFT|wx.RIGHT, 50)
        sizer.Add(self.txt_Password,0, wx.RIGHT, 50)

  # Submit button
        btn_Process = wx.Button(self.panel, -1, "&Login")
        self.panel.Bind(wx.EVT_BUTTON, self.OnSubmit, btn_Process)
        sizer.Add(btn_Process,0, wx.LEFT, 50)

        self.panel.SetSizer(sizer)

    def OnSubmit(self, event):
        UserText = self.txt_Username.GetValue()
        PasswordText = self.txt_Password.GetValue()
    

app=wx.App(False)
PerfFrame(None,"Oracle Perf Maintenance")
app.MainLoop()


While executing the program, I get a coredump on Click of the New Connection button.

Here is the backtrace information.

Code:
(gdb) bt
#0  0x00000000 in ?? ()
#1  0xb73a1ddf in wxWindow::DoAddChild(wxWindow*) () from /usr/lib/i386-linux-gnu/libwx_gtk2u_core-2.8.so.0
#2  0xb740e6d4 in wxTextCtrl::Create(wxWindow*, int, wxString const&, wxPoint const&, wxSize const&, long, wxValidator const&, wxString const&)
    () from /usr/lib/i386-linux-gnu/libwx_gtk2u_core-2.8.so.0
#3  0xb740eb3e in wxTextCtrl::wxTextCtrl(wxWindow*, int, wxString const&, wxPoint const&, wxSize const&, long, wxValidator const&, wxString const&) () from /usr/lib/i386-linux-gnu/libwx_gtk2u_core-2.8.so.0
#4  0xb5d2e26d in ?? () from /usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/_controls_.so
#5  0x0808c7bd in PyEval_EvalFrameEx ()
#6  0x081a7d70 in PyEval_EvalCodeEx ()
#7  0x081a9e42 in ?? ()
#8  0x0811101f in PyObject_Call ()
#9  0x080cc417 in ?? ()
#10 0x0811101f in PyObject_Call ()
#11 0x080cb3c6 in ?? ()
#12 0x08110ae9 in ?? ()
#13 0x0811101f in PyObject_Call ()
#14 0x080893c6 in PyEval_EvalFrameEx ()
#15 0x080890cc in PyEval_EvalFrameEx ()
#16 0x081a7d70 in PyEval_EvalCodeEx ()
#17 0x081a9cfe in ?? ()
#18 0x0811101f in PyObject_Call ()
#19 0x080cc417 in ?? ()
#20 0x0811101f in PyObject_Call ()
#21 0x080cb3c6 in ?? ()
#22 0x08110ae9 in ?? ()
#23 0x0811101f in PyObject_Call ()
#24 0x080893c6 in PyEval_EvalFrameEx ()
#25 0x081a7d70 in PyEval_EvalCodeEx ()
#26 0x081a9cfe in ?? ()
#27 0x0811101f in PyObject_Call ()
#28 0x080cc417 in ?? ()
#29 0x0811101f in PyObject_Call ()
#30 0x08114b19 in PyEval_CallObjectWithKeywords ()
#31 0xb7666e12 in wxPyCallback::EventThunker(wxEvent&) () from /usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/_core_.so
---Type <return> to continue, or q <return> to quit---
#32 0xb7137038 in wxAppConsole::HandleEvent(wxEvtHandler*, void (wxEvtHandler::*)(wxEvent&), wxEvent&) const ()
   from /usr/lib/i386-linux-gnu/libwx_baseu-2.8.so.0
#33 0xb71c678a in wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) ()
   from /usr/lib/i386-linux-gnu/libwx_baseu-2.8.so.0
#34 0xb71c6bb1 in wxEvtHandler::SearchDynamicEventTable(wxEvent&) () from /usr/lib/i386-linux-gnu/libwx_baseu-2.8.so.0
#35 0xb71c6c9c in wxEvtHandler::ProcessEvent(wxEvent&) () from /usr/lib/i386-linux-gnu/libwx_baseu-2.8.so.0
#36 0xb73f9fd7 in ?? () from /usr/lib/i386-linux-gnu/libwx_gtk2u_core-2.8.so.0
#37 0xb6a971ec in g_cclosure_marshal_VOID__VOID () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#38 0xb6a95484 in g_closure_invoke () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#39 0xb6aa70d9 in ?? () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#40 0xb6aaf2dc in g_signal_emit_valist () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#41 0xb6aaf453 in g_signal_emit () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#42 0xb6cf14ea in gtk_menu_item_activate () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#43 0xb203bc21 in ?? () from /usr/lib/i386-linux-gnu/libdbusmenu-gtk.so.4
#44 0xb6a97841 in g_cclosure_marshal_VOID(unsigned int0_t, void) () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#45 0xb6a95727 in ?? () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#46 0xb6aaea29 in g_signal_emit_valist () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#47 0xb6aaf453 in g_signal_emit () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#48 0xb20186fe in ?? () from /usr/lib/i386-linux-gnu/libdbusmenu-glib.so.4
#49 0xb201b4fe in dbusmenu_menuitem_handle_event () from /usr/lib/i386-linux-gnu/libdbusmenu-glib.so.4
#50 0xb201cde3 in ?? () from /usr/lib/i386-linux-gnu/libdbusmenu-glib.so.4
#51 0xb69d6a3f in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0
#52 0xb69d5cda in g_main_context_dispatch () from /lib/i386-linux-gnu/libglib-2.0.so.0
#53 0xb69d60e5 in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0
#54 0xb69d652b in g_main_loop_run () from /lib/i386-linux-gnu/libglib-2.0.so.0
#55 0xb6cdcb8f in gtk_main () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#56 0xb738e63a in wxEventLoop::Run() () from /usr/lib/i386-linux-gnu/libwx_gtk2u_core-2.8.so.0
#57 0xb741390f in wxAppBase::MainLoop() () from /usr/lib/i386-linux-gnu/libwx_gtk2u_core-2.8.so.0
#58 0xb7663523 in wxPyApp::MainLoop() () from /usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/_core_.so
#59 0xb76809b4 in ?? () from /usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/_core_.so
#60 0x0808c7bd in PyEval_EvalFrameEx ()
#61 0x081a7d70 in PyEval_EvalCodeEx ()
#62 0x081a9cfe in ?? ()
#63 0x0811101f in PyObject_Call ()
---Type <return> to continue, or q <return> to quit---
#64 0x080cc417 in ?? ()
#65 0x0811101f in PyObject_Call ()
#66 0x080893c6 in PyEval_EvalFrameEx ()
#67 0x080890cc in PyEval_EvalFrameEx ()
#68 0x081a7d70 in PyEval_EvalCodeEx ()
#69 0x08151e21 in PyRun_SimpleFileExFlags ()
#70 0x0815a4d9 in Py_Main ()
#71 0x0805e78b in main ()
(gdb) 


I don't know what is wrong here. Can someone help pls ?

Rgds,
Gokul

Reply With Quote
  #2  
Old October 16th, 2012, 11:37 AM
b49P23TIvg's Avatar
b49P23TIvg b49P23TIvg is offline
Contributing User
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Aug 2011
Posts: 3,380 b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 3 Days 13 h 7 m 19 sec
Reputation Power: 383
Excluding modules like ctypes, a high level interface (python) to a compiled library should not be able to dereference NULL.

I'd say you found a bug in wxWidgets C++ class library, and you should report it back through wxPython.

I haven't installed wx... . Sometimes you can work around this sort of problem by calling the routines in a different order.

Good luck.
__________________
[code]Code tags[/code] are essential for python code!

Reply With Quote
  #3  
Old October 16th, 2012, 12:26 PM
Purity_Lake Purity_Lake is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2012
Posts: 33 Purity_Lake User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 25 m 17 sec
Reputation Power: 2
Quote:
Originally Posted by b49P23TIvg
Excluding modules like ctypes, a high level interface (python) to a compiled library should not be able to dereference NULL.

I'd say you found a bug in wxWidgets C++ class library, and you should report it back through wxPython.

I haven't installed wx... . Sometimes you can work around this sort of problem by calling the routines in a different order.

Good luck.


I don't think gokulkumargopal can work around the code, i've been the testing the code for a while and traced the problem the the AP_LoginPanel call in his OnConn() function. debug informations says that __init__() requires exactly 3 arguments (1 given).. i have give a very large amount of arguments and yet for some reason it gives the exact same error, most likely a bug in the code, unless you have any idea why it wont accept all the the other parameters

Reply With Quote
  #4  
Old October 17th, 2012, 06:49 AM
gokulkumargopal gokulkumargopal is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 5 gokulkumargopal User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 32 m 54 sec
Reputation Power: 0
Thanks for your response. I removed the reference to panel in the below part of the code, and it worked. Not able to find the explanation here..

Code:
  # Username
        self.txt_Username = wx.TextCtrl(self, 1, size=(150, -1))
        lbl_Username = wx.StaticText(self, -1, "Username:")
        sizer.Add(lbl_Username,0, wx.LEFT|wx.TOP| wx.RIGHT, 50)
        sizer.Add(self.txt_Username,0, wx.TOP| wx.RIGHT, 50)

  # Password
        self.txt_Password = wx.TextCtrl(self, 1, size=(150, -1), style=wx.TE_PASSWORD)
        lbl_Password = wx.StaticText(self, -1, "Password:")
        sizer.Add(lbl_Password,0, wx.LEFT|wx.RIGHT, 50)
        sizer.Add(self.txt_Password,0, wx.RIGHT, 50)

  # Submit button
        btn_Process = wx.Button(self, -1, "&Login")
        self.Bind(wx.EVT_BUTTON, self.OnSubmit, btn_Process)
        sizer.Add(btn_Process,0, wx.LEFT, 50)

        self.SetSizer(sizer)

    def OnSubmit(self, event):
        UserText = self.txt_Username.GetValue()
        PasswordText = self.txt_Password.GetValue()

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Segmentation Fault on click to open new frame

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap