Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #73376

Re: Not Responding When Dealing with Large Data

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <torriem+gmail@torriefamily.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.011
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'responding': 0.07; 'callback': 0.09; 'calls.': 0.09; 'clock,': 0.09; 'run,': 0.09; 'runs': 0.10; 'gui': 0.12; 'anyway': 0.14; 'thread': 0.14; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'least.': 0.16; 'loop.': 0.16; 'spawn': 0.16; 'subject:Not': 0.16; 'tasks,': 0.16; 'variables,': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'basically': 0.19; 'pointed': 0.19; 'work,': 0.20; 'header :User-Agent:1': 0.23; 'text,': 0.24; 'question': 0.24; 'sort': 0.25; 'handling': 0.26; 'asking': 0.27; 'header:In-Reply-To:1': 0.27; 'rest': 0.29; 'am,': 0.29; 'direction': 0.30; 'programming.': 0.30; "i'm": 0.30; 'code': 0.31; 'lines': 0.31; '100000': 0.31; 'this.': 0.32; 'maybe': 0.34; 'problem': 0.35; 'subject:with': 0.35; 'done.': 0.35; 'google': 0.35; 'there': 0.35; 'event,': 0.36; 'idle': 0.36; 'programming,': 0.36; 'two': 0.37; 'list.': 0.37; 'message-id:@gmail.com': 0.38; 'handle': 0.38; 'to:addr:python-list': 0.38; 'rather': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'read': 0.60; 'event.': 0.60; 'new': 0.61; 'high': 0.63; 'kind': 0.63; 'love': 0.65; 'world': 0.66; 'details,': 0.68; 'wish': 0.70; 'asynchronous': 0.84; 'replay': 0.84; 'do:': 0.91; 'light.': 0.93
X-Virus-Scanned amavisd-new at torriefamily.org
Date Wed, 18 Jun 2014 13:25:35 -0600
From Michael Torrie <torriem@gmail.com>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131118 Thunderbird/17.0.11
MIME-Version 1.0
To python-list@python.org
Subject Re: Not Responding When Dealing with Large Data
References <00d330e3-fc8a-4b7e-b2bd-f1a48bc335c1@googlegroups.com>
In-Reply-To <00d330e3-fc8a-4b7e-b2bd-f1a48bc335c1@googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.11119.1403119551.18130.python-list@python.org> (permalink)
Lines 30
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1403119551 news.xs4all.nl 2855 [2001:888:2000:d::a6]:51791
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:73376

Show key headers only | View raw


On 06/18/2014 11:20 AM, cutey Love wrote:
> I'm trying to read in 100000 lines of text, use some functions to
> edit them and then return a new list.
> 
> The problem is my program always goes not responding when the amount
> of lines are a high number.
> 
> I don't care how long the program takes to work, just need it to stop
> crashing?

Welcome to the world of GUI programming. GUI programs are event-driven.
 When an event happens your code runs to handle the event.  While you
are handling an event, the rest of the GUI cannot run, until you return
control to the main loop.  So when you have to do long-running tasks,
you need to find a way to return control to the main loop while your
work continues.  There are basically two ways to do this. One is to
spawn a thread to do the work, the other is to use asynchronous
programming, depending on what you need to get done.  The problem with
threads is that you cannot directly make GUI calls. Instead you have to
set up a message queue of some sort, or maybe use flag variables, and
then have a callback that fires periodically, regularly with a some kind
of clock, or during the idle portion.

Anyway your question is light on details, so my replay is rather light.
 Hopefully you are now pointed in the right direction for asking
questions at least.  A quick google search reveals this which is pretty
much the sort of thing you wish to do:

http://stackoverflow.com/quhttp://stackoverflow.com/questions/16745507/tkinter-how-to-use-threads-to-preventing-main-event-loop-from-freezingestions/16745507/tkinter-how-to-use-threads-to-preventing-main-event-loop-from-freezing

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Not Responding When Dealing with Large Data cutey Love <cuteywithlove@gmail.com> - 2014-06-18 10:20 -0700
  Re: Not Responding When Dealing with Large Data Philip Dexter <philip.dexter@gmail.com> - 2014-06-18 13:36 -0400
  Re: Not Responding When Dealing with Large Data Tim <jtim.arnold@gmail.com> - 2014-06-18 11:37 -0700
  Re: Not Responding When Dealing with Large Data John Gordon <gordon@panix.com> - 2014-06-18 19:10 +0000
  Re: Not Responding When Dealing with Large Data Michael Torrie <torriem@gmail.com> - 2014-06-18 13:25 -0600
  Re: Not Responding When Dealing with Large Data Paul McNett <paul@mcnettware.com> - 2014-06-18 12:23 -0700
  Re: Not Responding When Dealing with Large Data cutey Love <cuteywithlove@gmail.com> - 2014-06-18 15:32 -0700
    Re: Not Responding When Dealing with Large Data Paul McNett <paul@mcnettware.com> - 2014-06-18 15:48 -0700
    Re: Not Responding When Dealing with Large Data Ian Kelly <ian.g.kelly@gmail.com> - 2014-06-18 17:06 -0600
      Re: Not Responding When Dealing with Large Data cutey Love <cuteywithlove@gmail.com> - 2014-06-19 01:17 -0700
        Re: Not Responding When Dealing with Large Data MRAB <python@mrabarnett.plus.com> - 2014-06-19 12:25 +0100
          Re: Not Responding When Dealing with Large Data Peter Pearson <ppearson@nowhere.invalid> - 2014-06-19 16:21 +0000
            Re: Not Responding When Dealing with Large Data MRAB <python@mrabarnett.plus.com> - 2014-06-19 17:54 +0100

csiph-web