472,799 Members | 1,565 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,799 software developers and data experts.

Tk and raw_input segfault

Python newbie disclaimer on

I am running an app with Tkinter screen in one thread and command-line
input in another thread using raw_input(). First question - is this
legal, should it run without issue? If not can you point me to a
description of why.

While updating objects on the screen I get a segfault after an
indeterminate number of updates. It doesn't seem to matter how quickly
the updates occur, but it does segfault faster when there are more
objects on the screen ( as I said failure time seems to have a random
factor added to it ).

Commenting out the raw_input() makes problem go away. I can schedule
as many updates as I wish without error. And it doesn't seem to matter
if I actually hit any keys for raw_input(), it can just sit there.

I have read other posts about readline library failures with Esc O M
sequences and could not recreate those failures.

This happens on 2 separate machines

1st: development workstation
Python 2.3.3 (#1, Feb 5 2005, 16:30:27)
[GCC 3.3.3 (SuSE Linux)] on linux2
Linux <name deleted> 2.6.5-7.151-smp #1 SMP Fri Mar 18 11:31:21 UTC
2005 x86_64 x86_64 x86_64 GNU/Linux

2nd: target machine
Python 2.3.3 (#1, Apr 6 2004, 01:47:39)
[GCC 3.3.3 (SuSE Linux)] on linux2
Linux <name deleted> 2.6.4-52-default #1 Wed Apr 7 02:08:30 UTC 2004
i686 i686 i386 GNU/Linux

I have tried to simplify the code as much as possible to make error
more visible( no actual updates of the screen etc ) I've uncommented
the "after" code line so it fails much more rapidly. I know its ugly
repeatedly scheduling the after but, the same code runs without the
raw_input, and it shows the error more readily.

To see the error start the code and click the button repeatedly until
it segfaults. It will still segfault if you remove the 'command'
funtion and call update dirctly - it just takes a bit longer and your
wrist will probably get tired.

Thanks in advance for any responses.

from Tkinter import *
from time import sleep
import thread

class Test(Frame):
def __init__(self, parent=None):
Frame.__init__(self, parent, bg='white')

# Button Definition: CLEAR ALL OUTPUTS
caB = Button( self, text='CLEAR ALL\nOUTPUTS',\
#command = (lambda: self.update()) )
command = (lambda: self.command()) )
self.updateCount = 0
self.commanded = 0

def command( self ):
self.commanded = 1

def update( self ):
self.updateCount += 1
print 'updatin... num = ', self.updateCount
self.after( 1, self.update )

def test():
root = Tk()

if __name__ == '__main__':
scanTID= thread.start_new_thread( test, () )

while True:
f= raw_input()
print 'f=', f

Jul 19 '05 #1
0 1771

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Nathaniel Echols | last post by:
I've written a function in C to perform protein sequence alignment. This works fine in a standalone C program. I've added the necessary packaging to use it in Python; it returns three strings and...
by: Stefan Behnel | last post by:
Hi! In Python 2.4b3, the deque is causing a segfault on two different machines I tested on. With deque, my program runs fine for a while (at least some tens of seconds up to minutes) and then...
by: J. W. McCall | last post by:
I'm working on a MUD server and I have a thread that gets keyboard input so that you can enter commands from the command line while it's in its main server loop. Everything works fine except that...
by: JerryKreps | last post by:
Hi, folks -- I'm a Python pup. As you can see from the session copied at the end of this post, I have the latest version of Python, and I've been using the Editor-Shell of the latest version of...
by: name | last post by:
When I started testing the algorithms for my wrap program, I threw together this snippet of code, which works quite well. Except that it (predictably) segfaults at the end when it tries to go...
by: planetthoughtful | last post by:
Hi All, As always, my posts come with a 'Warning: Newbie lies ahead!' disclaimer... I'm wondering if it's possible, using raw_input(), to provide a 'default' value with the prompt? I would...
by: Stuart McGraw | last post by:
In the announcement for Python-2.3 http://groups.google.com/group/comp.lang.python/msg/287e94d9fe25388d?hl=en it says "raw_input(): can now return Unicode objects". But I didn't see anything...
by: Mike Kent | last post by:
It's often useful for debugging to print something to stderr, and to route the error output to a file using '2>filename' on the command line. However, when I try that with a python script, all...
by: Dox33 | last post by:
I ran into a very strange behaviour of raw_input(). I hope somebody can tell me how to fix this. (Or is this a problem in the python source?) I will explain the problem by using 3 examples....
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
by: lllomh | last post by:
How does React native implement an English player?
by: Mushico | last post by:
How to calculate date of retirement from date of birth

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.