Skip to contentSkip to conversation

Alignment trap - deprecation.pyo

DISCUSSION ed 3 participants 5 messages Mar 13, 2010 – Mar 16, 2010

lore
Share & tools
lore

ed

author
#0 lore raw

I am trying to run a simple hello button python program using pygtk.

I have built a minimal-gpe-image for the mini2440.

But when I try and run the helloworld.py from the Pygtk tutorial.

=========================================================

#!/usr/bin/env python

# example helloworld.py

import pygtk
pygtk.require('2.0')
import gtk

class HelloWorld:

# This is a callback function. The data arguments are ignored # in this example. More on callbacks below.
def hello(self, widget, data=None):
print "Hello World"

def delete_event(self, widget, event, data=None):
# If you return FALSE in the "delete_event" signal handler, # GTK will emit the "destroy" signal. Returning TRUE means # you don't want the window to be destroyed.
# This is useful for popping up 'are you sure you want to quit?' # type dialogs.
print "delete event occurred"

# Change FALSE to TRUE and the main window will not be destroyed # with a "delete_event".
return False

def destroy(self, widget, data=None):
print "destroy signal occurred"
gtk.main_quit()

def __init__(self):
# create a new window
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)

# When the window is given the "delete_event" signal (this is
given

        # by the window manager, usually by the "close" option, or on
the
        # titlebar), we ask it to call the delete_event () function
        # as defined above. The data passed to the callback
        # function is NULL and is ignored in the callback function.
        self.window.connect("delete_event", self.delete_event)

# Here we connect the "destroy" event to a signal handler. # This event occurs when we call gtk_widget_destroy() on the
window,

        # or if we return FALSE in the "delete_event" callback.
        self.window.connect("destroy", self.destroy)

# Sets the border width of the window.
self.window.set_border_width(10)

# Creates a new button with the label "Hello World". self.button = gtk.Button("Hello World")

# When the button receives the "clicked" signal, it will call
the

        # function hello() passing it None as its argument.  The hello()
        # function is defined above.
        self.button.connect("clicked", self.hello, None)

# This will cause the window to be destroyed by calling # gtk_widget_destroy(window) when "clicked". Again, the destroy # signal could come from here, or the window manager. self.button.connect_object("clicked", gtk.Widget.destroy,
self.window)

# This packs the button into the window (a GTK container). self.window.add(self.button)

# The final step is to display this newly created widget. self.button.show()

# and the window
self.window.show()

def main(self):
# All PyGTK applications must have a gtk.main(). Control ends
here

        # and waits for an event to occur (like a key press or mouse
event).
        gtk.main()

# If the program is run directly or passed as an argument to the python

# interpreter then create a HelloWorld instance and show it
if __name__ == "__main__":
    hello = HelloWorld()
    hello.main()

==============================================================

I get the follow error when I run
#python -v pygtkHelloWorld.py

# /usr/lib/python2.6/site-packages/gtk-2.0/gtk/_lazyutils.pyo
matches /usr/lib/python2.6/site-packages/gtk-2.0/gtk/_lazyutils.py
import gtk._lazyutils # precompiled
from /usr/lib/python2.6/site-packages/gtk-2.0/gtk/_lazyutils.pyo
# /usr/lib/python2.6/site-packages/gtk-2.0/gtk/deprecation.pyo
matches /usr/lib/python2.6/site-packages/gtk-2.0/gtk/deprecation.py
import gtk.deprecation # precompiled
from /usr/lib/python2.6/site-packages/gtk-2.0/gtk/deprecation.pyo
Alignment trap: python (2412) PC=0x40bfa3c4 Instr=0x280069c0
Address=0xffffffff FSR 0x813
Segmentation fault

Does anyone have any ideas why it chokes at deprecation.pyo?????

Thanks
Ed

#1 lore raw
Quoted 14 lines
# /usr/lib/python2.6/site-packages/gtk-2.0/gtk/_lazyutils.pyo
matches /usr/lib/python2.6/site-packages/gtk-2.0/gtk/_lazyutils.py
import gtk._lazyutils # precompiled
from /usr/lib/python2.6/site-packages/gtk-2.0/gtk/_lazyutils.pyo
# /usr/lib/python2.6/site-packages/gtk-2.0/gtk/deprecation.pyo
matches /usr/lib/python2.6/site-packages/gtk-2.0/gtk/deprecation.py
import gtk.deprecation # precompiled
from /usr/lib/python2.6/site-packages/gtk-2.0/gtk/deprecation.pyo
Alignment trap: python (2412) PC=0x40bfa3c4 Instr=0x280069c0
Address=0xffffffff FSR 0x813
Segmentation fault
Quoted 1 line

Does anyone have any ideas why it chokes at deprecation.pyo?????

No. but you could enable the generation of a coredump with ulimit and then use gdb to figure out where it was generating this alignment trap.

author
#2 lore raw
Quoted 13 lines · Holger Hans Peter Freyther
Quoted 13 lines
# /usr/lib/python2.6/site-packages/gtk-2.0/gtk/_lazyutils.pyo
matches /usr/lib/python2.6/site-packages/gtk-2.0/gtk/_lazyutils.py
import gtk._lazyutils # precompiled
from /usr/lib/python2.6/site-packages/gtk-2.0/gtk/_lazyutils.pyo
# /usr/lib/python2.6/site-packages/gtk-2.0/gtk/deprecation.pyo
matches /usr/lib/python2.6/site-packages/gtk-2.0/gtk/deprecation.py
import gtk.deprecation # precompiled
from /usr/lib/python2.6/site-packages/gtk-2.0/gtk/deprecation.pyo
Alignment trap: python (2412) PC=0x40bfa3c4 Instr=0x280069c0
Address=0xffffffff FSR 0x813
Segmentation fault
Quoted 6 lines
Quoted 1 line

Does anyone have any ideas why it chokes at deprecation.pyo?????

No. but you could enable the generation of a coredump with ulimit and then use gdb to figure out where it was generating this alignment trap.

Holger thanks for responding. I know you and everyone else on the list are very busy and I appreciate if I get a response. I try and find help using google but that does not always pan out.

So taking your suggestion I am trying to use gdbsever but without much
success. This is what I have done.

1. Built image to include gdbserver.
2. Downloaded to my PC python2.6-dbg
3. Downloaded GDB Macros and placed in home/ed/ as .gdbinit
4. On host in terminal window
a. $gdb python
b. (gdb) target remote 192.168.1.104:2345
c. where 192.168.1.104 is IP address of target board(mini2440) d. Go to target machine and do step 5.
e. eventually I get connection timed out.
f. I can ping the target machine from the host.
5. On target machine
a. Verify that ulimit is set to unlimted
b. #gdbserver 192.168.1.100:2345 python pygtkHelloWorld c. where 192.168.1.100 is the IP address of the host machine d. nothing comes back when I enter the above command. I would have
thought from reading the wiki page
http://en.wikipedia.org/wiki/Gdbserver that I should see something after entering the command.

I did an strace on # strace gdbserver 192.168.1.100:2345 python and to see if it would work with just running python. I get the following trace.

root@mini2440:~# strace gdbserver 192.168.1.100:2345 python
execve("/usr/bin/gdbserver", ["gdbserver", "192.168.1.100:2345",
"python"], [/* 12 vars */]) = 0
brk(0)                                  = 0x21000
uname({sys="Linux", node="mini2440", ...}) = 0
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or
directory)
open("/var/run/ld.so.cache", O_RDONLY)  = -1 ENOENT (No such file or
directory)
open("/lib/tls/v4l/half/libthread_db.so.1", O_RDONLY) = -1 ENOENT (No
such file or directory)
stat64("/lib/tls/v4l/half", 0xbe8ae220) = -1 ENOENT (No such file or
directory)
open("/lib/tls/v4l/libthread_db.so.1", O_RDONLY) = -1 ENOENT (No such
file or directory)
stat64("/lib/tls/v4l", 0xbe8ae220)      = -1 ENOENT (No such file or
directory)
open("/lib/tls/half/libthread_db.so.1", O_RDONLY) = -1 ENOENT (No such
file or directory)
stat64("/lib/tls/half", 0xbe8ae220)     = -1 ENOENT (No such file or
directory)
open("/lib/tls/libthread_db.so.1", O_RDONLY) = -1 ENOENT (No such file
or directory)
stat64("/lib/tls", 0xbe8ae220)          = -1 ENOENT (No such file or
directory)
open("/lib/v4l/half/libthread_db.so.1", O_RDONLY) = -1 ENOENT (No such
file or directory)
stat64("/lib/v4l/half", 0xbe8ae220)     = -1 ENOENT (No such file or
directory)
open("/lib/v4l/libthread_db.so.1", O_RDONLY) = -1 ENOENT (No such file
or directory)
stat64("/lib/v4l", 0xbe8ae220)          = -1 ENOENT (No such file or
directory)
open("/lib/half/libthread_db.so.1", O_RDONLY) = -1 ENOENT (No such file
or directory)
stat64("/lib/half", 0xbe8ae220)         = -1 ENOENT (No such file or
directory)
open("/lib/libthread_db.so.1", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\0\17\0\000"...,
512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=26304, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0x4001c000
mmap2(NULL, 57676, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0)
= 0x40025000
mprotect(0x4002b000, 28672, PROT_NONE)  = 0
mmap2(0x40032000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|
MAP_DENYWRITE, 3, 0x5) = 0x40032000
close(3)                                = 0
open("/lib/libc.so.6", O_RDONLY)        = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\344K\1\000"...,
512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1127916, ...}) = 0
mmap2(NULL, 1163712, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3,
0) = 0x40034000
mprotect(0x40143000, 32768, PROT_NONE)  = 0
mmap2(0x4014b000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|
MAP_DENYWRITE, 3, 0x10f) = 0x4014b000
mmap2(0x4014e000, 8640, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|
MAP_ANONYMOUS, -1, 0) = 0x4014e000
close(3)                                = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0x4001d000
syscall_983045(0x4001cd40, 0x4001cd40, 0x68c, 0x4001d418, 0x40024060,
0x40024000, 0, 0xf0005, 0x60, 0xffff5874, 0, 0xbe8aeae4, 0, 0xbe8ae7e0,
0x40002010, 0x40002028, 0x20000010, 0x4001cd40, 0xb719, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0) = 0
mprotect(0x4014b000, 8192, PROT_READ)   = 0
mprotect(0x40032000, 4096, PROT_READ)   = 0
mprotect(0x40023000, 4096, PROT_READ)   = 0
rt_sigaction(SIGIO, {SIG_IGN}, {SIG_DFL}, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [IO], NULL, 8) = 0
brk(0)                                  = 0x21000
brk(0x42000)                            = 0x42000
clone(child_stack=0x22068, flags=CLONE_VM|SIGCHLD) = 2898
wait4(2898,  <unfinished ... exit status 0>
Process 2897 detached

==========================

Is there something I have not set up correctly or some step that is not done correctly?
Any help will be appreciated.
Thanks
Ed

Quoted 4 lines

_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel

#3 lore raw
In reply to ed

ed,

Are you able to use the python interactive shell on your mini2440? I had a similar problem in that python would fail to even start (resulting in an alignment trap).

For me simply removing /usr/lib/python2.6/lib-dynload/readline.so kept python from dying on startup.

Quoted 128 lines · ed

I am trying to run a simple hello button python program using pygtk.

I have built a minimal-gpe-image for the mini2440.

But when I try and run the helloworld.py from the Pygtk tutorial.

=========================================================

#!/usr/bin/env python

# example helloworld.py

import pygtk
pygtk.require('2.0')
import gtk

class HelloWorld:

# This is a callback function. The data arguments are ignored # in this example. More on callbacks below.
def hello(self, widget, data=None):
print "Hello World"

def delete_event(self, widget, event, data=None):
# If you return FALSE in the "delete_event" signal handler, # GTK will emit the "destroy" signal. Returning TRUE means # you don't want the window to be destroyed.
# This is useful for popping up 'are you sure you want to quit?' # type dialogs.
print "delete event occurred"

# Change FALSE to TRUE and the main window will not be destroyed # with a "delete_event".
return False

def destroy(self, widget, data=None):
print "destroy signal occurred"
gtk.main_quit()

def __init__(self):
# create a new window
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)

# When the window is given the "delete_event" signal (this is
given

         # by the window manager, usually by the "close" option, or on
the
         # titlebar), we ask it to call the delete_event () function
         # as defined above. The data passed to the callback
         # function is NULL and is ignored in the callback function.
         self.window.connect("delete_event", self.delete_event)

# Here we connect the "destroy" event to a signal handler. # This event occurs when we call gtk_widget_destroy() on the
window,

         # or if we return FALSE in the "delete_event" callback.
         self.window.connect("destroy", self.destroy)

# Sets the border width of the window.
self.window.set_border_width(10)

# Creates a new button with the label "Hello World". self.button = gtk.Button("Hello World")

# When the button receives the "clicked" signal, it will call
the

         # function hello() passing it None as its argument.  The hello()
         # function is defined above.
         self.button.connect("clicked", self.hello, None)

# This will cause the window to be destroyed by calling # gtk_widget_destroy(window) when "clicked". Again, the destroy # signal could come from here, or the window manager. self.button.connect_object("clicked", gtk.Widget.destroy,
self.window)

# This packs the button into the window (a GTK container). self.window.add(self.button)

# The final step is to display this newly created widget. self.button.show()

# and the window
self.window.show()

def main(self):
# All PyGTK applications must have a gtk.main(). Control ends
here

         # and waits for an event to occur (like a key press or mouse
event).
         gtk.main()

# If the program is run directly or passed as an argument to the python

# interpreter then create a HelloWorld instance and show it
if __name__ == "__main__":
     hello = HelloWorld()
     hello.main()

==============================================================

I get the follow error when I run
#python -v pygtkHelloWorld.py

# /usr/lib/python2.6/site-packages/gtk-2.0/gtk/_lazyutils.pyo
matches /usr/lib/python2.6/site-packages/gtk-2.0/gtk/_lazyutils.py
import gtk._lazyutils # precompiled
from /usr/lib/python2.6/site-packages/gtk-2.0/gtk/_lazyutils.pyo
# /usr/lib/python2.6/site-packages/gtk-2.0/gtk/deprecation.pyo
matches /usr/lib/python2.6/site-packages/gtk-2.0/gtk/deprecation.py
import gtk.deprecation # precompiled
from /usr/lib/python2.6/site-packages/gtk-2.0/gtk/deprecation.pyo
Alignment trap: python (2412) PC=0x40bfa3c4 Instr=0x280069c0
Address=0xffffffff FSR 0x813
Segmentation fault

Does anyone have any ideas why it chokes at deprecation.pyo?????

Thanks
Ed

_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel

author
#4 lore raw
Quoted 140 lines · Josh Kropf

ed,

Are you able to use the python interactive shell on your mini2440? I had a similar problem in that python would fail to even start (resulting in an alignment trap).

For me simply removing /usr/lib/python2.6/lib-dynload/readline.so kept python from dying on startup.

Quoted 127 lines · ed

I am trying to run a simple hello button python program using pygtk.

I have built a minimal-gpe-image for the mini2440.

But when I try and run the helloworld.py from the Pygtk tutorial.

=========================================================

#!/usr/bin/env python

# example helloworld.py

import pygtk
pygtk.require('2.0')
import gtk

class HelloWorld:

# This is a callback function. The data arguments are ignored # in this example. More on callbacks below.
def hello(self, widget, data=None):
print "Hello World"

def delete_event(self, widget, event, data=None):
# If you return FALSE in the "delete_event" signal handler, # GTK will emit the "destroy" signal. Returning TRUE means # you don't want the window to be destroyed.
# This is useful for popping up 'are you sure you want to
quit?'

         # type dialogs.
         print "delete event occurred"

# Change FALSE to TRUE and the main window will not be
destroyed

         # with a "delete_event".
         return False

def destroy(self, widget, data=None):
print "destroy signal occurred"
gtk.main_quit()

def __init__(self):
# create a new window
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)

# When the window is given the "delete_event" signal (this is
given

         # by the window manager, usually by the "close" option, or on
the
         # titlebar), we ask it to call the delete_event () function
         # as defined above. The data passed to the callback
         # function is NULL and is ignored in the callback function.
         self.window.connect("delete_event", self.delete_event)

# Here we connect the "destroy" event to a signal handler. # This event occurs when we call gtk_widget_destroy() on the
window,

         # or if we return FALSE in the "delete_event" callback.
         self.window.connect("destroy", self.destroy)

# Sets the border width of the window.
self.window.set_border_width(10)

# Creates a new button with the label "Hello World". self.button = gtk.Button("Hello World")

# When the button receives the "clicked" signal, it will call
the

         # function hello() passing it None as its argument.  The 
hello()
         # function is defined above.
         self.button.connect("clicked", self.hello, None)

# This will cause the window to be destroyed by calling # gtk_widget_destroy(window) when "clicked". Again, the
destroy

         # signal could come from here, or the window manager.
         self.button.connect_object("clicked", gtk.Widget.destroy,
self.window)

# This packs the button into the window (a GTK container). self.window.add(self.button)

# The final step is to display this newly created widget. self.button.show()

# and the window
self.window.show()

def main(self):
# All PyGTK applications must have a gtk.main(). Control ends
here

         # and waits for an event to occur (like a key press or mouse
event).
         gtk.main()

# If the program is run directly or passed as an argument to the python

# interpreter then create a HelloWorld instance and show it
if __name__ == "__main__":
     hello = HelloWorld()
     hello.main()

==============================================================

I get the follow error when I run
#python -v pygtkHelloWorld.py

# /usr/lib/python2.6/site-packages/gtk-2.0/gtk/_lazyutils.pyo
matches /usr/lib/python2.6/site-packages/gtk-2.0/gtk/_lazyutils.py
import gtk._lazyutils # precompiled
from /usr/lib/python2.6/site-packages/gtk-2.0/gtk/_lazyutils.pyo
# /usr/lib/python2.6/site-packages/gtk-2.0/gtk/deprecation.pyo
matches /usr/lib/python2.6/site-packages/gtk-2.0/gtk/deprecation.py
import gtk.deprecation # precompiled
from /usr/lib/python2.6/site-packages/gtk-2.0/gtk/deprecation.pyo
Alignment trap: python (2412) PC=0x40bfa3c4 Instr=0x280069c0
Address=0xffffffff FSR 0x813
Segmentation fault

Does anyone have any ideas why it chokes at deprecation.pyo?????

Thanks
Ed

Quoted 5 lines

_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel

Quoted 5 lines

_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel

I can run python programs but can't run pygtk programs. When I use the python interactive shell I get the Alignment trap then Segment fault when I try and import gtk which is what the deprecation.pyo is doing.

Quoted 1 line
Quoted 1 line
Quoted 1 line

import gtk

Alignment trap
Segment fault.