[pygtk] Python code works in terminal but not with shortcut on the gnome panal

Edward A Robinson earobinson at gmail.com
Fri Mar 30 06:03:27 WST 2007


Any Ideas on how to debug code without the terminal, the problem is
that it only happens without the terminal so I have no real idea how
to debug it.

On 3/29/07, Felix Rabe (public) <public at felixrabe.textdriven.com> wrote:
> > try:
> >    url_content = urllib.urlopen('http://www.google.com')
> >    main_window.add(gtk.Label(url_content.read()))
> > except IOError:
> >    main_window.add(gtk.Label('             Error            '))
>
> You should be able to debug the code yourself to find out what's going on:
>
> First, omit the whole try:... except... clause from your code.  If that
> "helped", go on by adding a general except: clause with a label that
> tells you that an unexpected exception happened.  Then go on in that
> fashion and you should be able to find your way.
>
> Wikipedia has an article on debugging, I'm giving you the direct link to
> your step: http://en.wikipedia.org/wiki/Debugging#Isolate_source_of_bug
>
> I hope you find the bug.  If you do, tell me (no need to reply to the
> list then) what caused it, I'm curious about this one :o)
>
> - Felix
>


-- 
Edward A Robinson


More information about the pygtk mailing list