[Tutor] Segmentation Fault Problem

Tim Johnson tim at johnsons-web.com
Fri Jan 2 17:25:25 EST 2004


* Anschau Gesicht <anschau at shaw.ca> [040102 10:58]:
> I continue on my endless(and seemingly futile)attempt to learn a
> programming language.  Currently I'm attempting small scripts in
> Python/Tkinter.  The particular script is a textbox script at follows
> 
> #!/usr/lib/python2.2
> 
> from Tkinter import *
> from ScrolledText import *
> import sys
> 
> def die(event):
>   sys.exit(0)
> 
> root = Tk()
> f = Frame(root)
> f.pack(expand=1, fill=BOTH)
> button = Button(f, width=25)
> button["text"] = "Button"
> button.bind("<Button>",die)
> button.pack()
> 
> st = ScrolledText(f,background="white")
> st.pack()
> 
> root.mainloop()
> 
> Very simple and straight forward but if I mouseclick in the text window
> the program seg faults.  Can anyone tell me why?  As an aside, I cannot
> use idle (a text editor) because it seg faults everytime I try to
> initialize.  
> 
> Eve
> 
> P.S. My platform is RedHat Linux v 9 and Python v2.2
 
 I'm using the same. And in my case is an upgrade from
 a RH 7.2 fresh install, our experience is that upgrades
 on RH can get messy.

 Here's a couple of things that I would do:
 From a console
 execute as follows:
 [tim at linus tim]$ /usr/lib/python2.2
 # result on my machine:
 bash: /usr/lib/python2.2: is a directory
 # Hmm! Not pointing to an executable

 Try this also
 [tim at linus tim]$ which python
 # result: the executable at path below.
 /usr/local/bin/python

 Execute the the which path, just to see what version it
 is:
[tim at linus tim]$ /usr/local/bin/python
Python 2.2.2 (#1, Nov  2 2003, 13:27:48)
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

 You might want to try a simple "helloworld" approach
 as in below (caution untested code with psuedo-tag)

 #!<path result from $ which python>
 print "hello"

 See what happens then...
 If that works, then try the simplest possible
 tk call, if it breaks, as has been suggested by others,
 you may need to confirm what version of tk/tkinter
 you're using.

 tim

-- 
Tim Johnson <tim at johnsons-web.com>
      http://www.alaska-internet-solutions.com



More information about the Tutor mailing list