There probably is some bad translation of NULL (lang C) and Null (lang Python) going on.
But if your widget is good, it wont be NULL or Null and your program should run OK. So test your widget:
if widget is None:
# do some error code
sys.stderr.write( '%s was not found in glade file %s', % \
( widgetname, ( os.path.join( os.getcwd() , 'sgis/sgis.xml' ) ) ) )
sys.exit(1)
Then you know what, if anything is broken. During debugging, it's very good to make a function to do this
test on every glade file access. A mistype, wrong case or 0 vs 'O' can cause a lot of head aches (personal
experience).
After you've finished debugging your script, it's a pygtk/C code warning issue. Ignore it and redirect your
errors using sys.stderr reassignment. Reassigning sys.stderr is easy (Python is such a sweet language!).
Open a python window and try:
>>> import sys
# assign to a desired object that has a 'write' function (required)
sys.stderr = open('/tmp/testerr','w')
sys.stderr.write('test complete')
# reassign to original; __stderr__ always maintains the file object of the original stderr.
sys.stderr = sys.__stderr__
sys.stderr.write('test complete 1')
test complete 1>>>
@ shell prompt
cat /tmp/testerr
test complete[ [EMAIL PROTECTED]~]
(not the lack of a linefeed, you have to provide that too!)
sph
On Mon, 2005-08-08 at 09:25 -0500, Jaime Casanova wrote:
Hi,
i'm using libglade to build an interface to my python application.
i'm using python 2.4 and pygtk 2.4.1-3 in winxp and for fedora core2
this is my python code
*** BEGIN PYTHON CODE prueba.py ***
import gtk
import gtk.glade
def some_handler(widget):
pass
xml = gtk.glade.XML('sgis/sgis.xml', "", "")
widget = xml.get_widget('widgetname')
xml.signal_autoconnect({
'some_handler': some_handler
})
gtk.main()
*** END PYTHON CODE ***
but when i try to run get this error from both winxp and linux:
(prueba.py:2959): libglade-CRITICAL **: file glade-xml.c: line 1198
(glade_xml_build_interface): assertion `wid != NULL' failed
well... actually, the numbers in prueba.py:xxx are different in the
winxp version of the error, but the rest of the line is the same.
comments? someone has seen this before?
_______________________________________________ pygtk mailing list [email protected] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
