MOn Tue, Nov 19, 2013 at 10:35 AM, Jai
wrote:
> please help what is this i have try lot but unable to remove it
Your code is getting into an infinite loop.
One problem is, I suspect:
> def find_position(line):
> pun = ""
> if re.search(r"[.?!]+", line):
> pun = re.search(r"[.?!]
On 19/11/2013 15:35, Jai wrote:
Code
#
#!/usr/bin/env python
import sys, re
def find_position(line):
pun = ""
if re.search(r"[.?!]+", line):
pun = re.search(r"[.?!]+", line).group()
pos = line.find(pun)
pos = pos+len(pun)-1
retu
En Thu, 10 Dec 2009 20:43:48 -0300, mattia escribió:
Il Thu, 10 Dec 2009 23:10:02 +, Matthew Barnett ha scritto:
Only the main thread can receive the keyboard interrupt.
Ok, so is there any way to stop all the threads if the keyboard interrupt
is received?
If all other threads (except
On 12/11/2009 10:43 AM, mattia wrote:
Ok, so is there any way to stop all the threads if the keyboard interrupt
is received?
You can't stop a thread from outside. The thread has to end itself (by
ending the function). Usually, in the thread, you will check the value
of a variable. If it's fal
Il Wed, 09 Dec 2009 16:19:24 -0800, Jon Clements ha scritto:
> On Dec 9, 11:53 pm, mattia wrote:
>> Hi all, can you provide me a simple code snippet to interrupt the
>> execution of my program catching the KeyboardInterrupt signal?
>>
>> Thanks,
>> Mattia
>
> Errr, normally you can just catch th
On Dec 9, 11:53 pm, mattia wrote:
> Hi all, can you provide me a simple code snippet to interrupt the
> execution of my program catching the KeyboardInterrupt signal?
>
> Thanks,
> Mattia
Errr, normally you can just catch the KeyboardInterrupt exception --
is that what you mean?
Jon.
--
http://
Il Thu, 10 Dec 2009 23:10:02 +, Matthew Barnett ha scritto:
> mattia wrote:
>> Il Thu, 10 Dec 2009 04:56:33 +, Brad Harms ha scritto:
>>
>>> On Thu, 10 Dec 2009 00:29:45 +, mattia wrote:
>>>
Il Wed, 09 Dec 2009 16:19:24 -0800, Jon Clements ha scritto:
> On Dec 9, 11:53 p
mattia wrote:
Il Thu, 10 Dec 2009 04:56:33 +, Brad Harms ha scritto:
On Thu, 10 Dec 2009 00:29:45 +, mattia wrote:
Il Wed, 09 Dec 2009 16:19:24 -0800, Jon Clements ha scritto:
On Dec 9, 11:53 pm, mattia wrote:
Hi all, can you provide me a simple code snippet to interrupt the
execu
On Thu, Dec 10, 2009 at 4:42 PM, mattia wrote:
> def go():
>threads = [Thread(target=do_work, args=()) for _ in range(2)]
>for t in threads:
>t.start()
>for t in threads:
>t.join()
>
The KeyboardInterrupt goes to the main thread, which is sitting there in
t.join() wit
Il Thu, 10 Dec 2009 04:56:33 +, Brad Harms ha scritto:
> On Thu, 10 Dec 2009 00:29:45 +, mattia wrote:
>
>> Il Wed, 09 Dec 2009 16:19:24 -0800, Jon Clements ha scritto:
>>
>>> On Dec 9, 11:53 pm, mattia wrote:
Hi all, can you provide me a simple code snippet to interrupt the
e
On Thu, 10 Dec 2009 00:29:45 +, mattia wrote:
> Il Wed, 09 Dec 2009 16:19:24 -0800, Jon Clements ha scritto:
>
>> On Dec 9, 11:53 pm, mattia wrote:
>>> Hi all, can you provide me a simple code snippet to interrupt the
>>> execution of my program catching the KeyboardInterrupt signal?
>>>
>>>
On Jun 20, 2009, at 10:21 PM, greg wrote:
Philip Semanchuk wrote:
Best of all, PyErr_CheckSignals() doesn't interfere with a Python-
level signal handler if one is set.
Ah, I hadn't realised that you were doing this in C
code, and I was trying to think of a Python-level
solution.
For C co
Philip Semanchuk wrote:
Best of all, PyErr_CheckSignals() doesn't interfere with a Python- level
signal handler if one is set.
Ah, I hadn't realised that you were doing this in C
code, and I was trying to think of a Python-level
solution.
For C code, the solution you give sounds like a
good o
On Jun 20, 2009, at 7:41 AM, Piet van Oostrum wrote:
After my previous experiment I was curious how this works with
input(). I replaced the sem.acquire() with raw_input() and ran the
same
tests. Now the inner exception is really taken so it works like the OP
expected. The exception, however
After my previous experiment I was curious how this works with
input(). I replaced the sem.acquire() with raw_input() and ran the same
tests. Now the inner exception is really taken so it works like the OP
expected. The exception, however is KeyboardInterrupt, not the special
exception from the IPC
> greg (g) wrote:
>g> Philip Semanchuk wrote:
>>> try:
>>> sem.acquire() # User hits Ctrl + C while this is waiting
>>> except:
>>> print "* I caught it!"
>>> Instead a KeyboardInterrupt error is propagated up to the interpreter
>>> and the process is killed as if the try/except wa
Philip Semanchuk wrote:
try:
sem.acquire() # User hits Ctrl + C while this is waiting
except:
print "* I caught it!"
Instead a KeyboardInterrupt error is propagated up to the interpreter
and the process is killed as if the try/except wasn't there at all.
Not sure exactly wh
Gabriel Genellina wrote:
En Sat, 16 May 2009 04:04:03 -0300, Igor Katson
escribió:
Gabriel Genellina wrote:
En Fri, 15 May 2009 09:04:05 -0300, Igor Katson escribió:
Lawrence D'Oliveiro wrote:
In message ,
Igor Katson wrote:
Lawrence D'Oliveiro wrote:
In message ,
Igor Katson wrote:
I h
En Sat, 16 May 2009 04:04:03 -0300, Igor Katson
escribió:
Gabriel Genellina wrote:
En Fri, 15 May 2009 09:04:05 -0300, Igor Katson escribió:
Lawrence D'Oliveiro wrote:
In message , Igor
Katson wrote:
Lawrence D'Oliveiro wrote:
In message ,
Igor Katson wrote:
I have problems in getting
Gabriel Genellina wrote:
En Fri, 15 May 2009 09:04:05 -0300, Igor Katson escribió:
Lawrence D'Oliveiro wrote:
In message ,
Igor Katson wrote:
Lawrence D'Oliveiro wrote:
In message ,
Igor Katson wrote:
I have problems in getting a SocketServer to shutdown.
Do you want to do a shutdown or
Gabriel Genellina wrote:
En Fri, 15 May 2009 09:04:05 -0300, Igor Katson escribió:
Lawrence D'Oliveiro wrote:
In message ,
Igor Katson wrote:
Lawrence D'Oliveiro wrote:
In message ,
Igor Katson wrote:
I have problems in getting a SocketServer to shutdown.
Do you want to do a shutdown or
En Fri, 15 May 2009 09:04:05 -0300, Igor Katson escribió:
Lawrence D'Oliveiro wrote:
In message , Igor
Katson wrote:
Lawrence D'Oliveiro wrote:
In message , Igor
Katson wrote:
I have problems in getting a SocketServer to shutdown.
Do you want to do a shutdown or a close?
I want the se
Lawrence D'Oliveiro wrote:
In message , Igor Katson
wrote:
Lawrence D'Oliveiro wrote:
In message , Igor
Katson wrote:
I have problems in getting a SocketServer to shutdown.
Do you want to do a shutdown or a close?
I want the server close the socket ...
In message , Igor Katson
wrote:
> Lawrence D'Oliveiro wrote:
>
>> In message , Igor
>> Katson wrote:
>>
>>> I have problems in getting a SocketServer to shutdown.
>>
>> Do you want to do a shutdown or a close?
>>
> I want the server close the socket ...
You want to do a close, do a close,
Lawrence D'Oliveiro wrote:
In message , Igor Katson
wrote:
I have problems in getting a SocketServer to shutdown.
Do you want to do a shutdown or a close?
I want the server close the socket, and the program to continue after
that (in this case, just to terminate).
--
http://mai
In message , Igor Katson
wrote:
> I have problems in getting a SocketServer to shutdown.
Do you want to do a shutdown or a close?
--
http://mail.python.org/mailman/listinfo/python-list
In article <[EMAIL PROTECTED]>,
Michael Goerz <[EMAIL PROTECTED]> wrote:
> But as it seems, a keyboard interrupt will automatically pass down to
> the subprocesses, causing them to abort. Is there a way that I can
> prevent the subprocesses from being canceled by a keyboard interrupt?
You mi
On 16 Feb., 12:16, [EMAIL PROTECTED] wrote:
> On 16 Feb., 11:44, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote:
>
> I've tried it in cygwin, result:
$ python.exe c:/work/py_src/ctrl_test.py
kbd-interr,SystemExit
normal end
br Rudi
--
http://mail.python.org/mailman/listinfo/python-list
On 16 Feb., 11:44, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote:
Thanks to all of you, for the fast answers.
The code I showed you is actually the code running. I tried to catch
eof, cause I read ^C could produce EOF (the self.showtraceback() was
just a stupid cut 'n paste). But not even the exce
En Fri, 16 Feb 2007 07:26:09 -0300, Steven D'Aprano
<[EMAIL PROTECTED]> escribió:
> I seem to have a vague recollection that the keyboard interrupt under
> Windows isn't ^C but something else... ^Z maybe?
Ctrl-C is the keyboard interrupt, Ctrl-Z means EOF.
--
Gabriel Genellina
--
http://mai
On Fri, 16 Feb 2007 01:47:43 -0800, ruka_at_ wrote:
> Hi,
> why is KeyboardInterrupt not caught (xp)?
> import sys
> try:
> inp = sys.stdin.read()
> except (KeyboardInterrupt, SystemExit):
> print "kbd-interr,SystemExit"
> except EOFError:
> print "eof encountered"
I don't think you e
En Fri, 16 Feb 2007 06:58:54 -0300, Daniel Nogradi <[EMAIL PROTECTED]>
escribió:
>> why is KeyboardInterrupt not caught (xp)?
>
> Hi, are you sure this is exactly what you run?
> The code above works perfectly for me and prints
>
> kbd-interr,SystemExit
> normal end
>
> as it should upon pressin
> why is KeyboardInterrupt not caught (xp)?
> import sys
> try:
> inp = sys.stdin.read()
> except (KeyboardInterrupt, SystemExit):
> print "kbd-interr,SystemExit"
> except EOFError:
> print "eof encountered"
> except:
> print "caught all"
> self.showtraceback()
> print "normal e
On Wed, 2006-11-22 at 19:45 +0100, Fredrik Lundh wrote:
> Fredrik Tolf wrote:
>
> > So how does it work? Does my code get to return Py_FALSE, and the
> > interpreter ignores it, seeing that an exception is set? Is a non-local
> > exit performed right over my call stack (in which case my next quest
Fredrik Tolf wrote:
> So how does it work? Does my code get to return Py_FALSE, and the
> interpreter ignores it, seeing that an exception is set? Is a non-local
> exit performed right over my call stack (in which case my next question
> would be how to clean up resources being used from my C code
On 22 Oct 2005 22:02:46 +0200, Dieter Maurer <[EMAIL PROTECTED]> wrote:
>"Tamas Nepusz" <[EMAIL PROTECTED]> writes on 20 Oct 2005 15:39:54 -0700:
>> The library I'm working on
>> is designed for performing calculations on large-scale graphs (~1
>> nodes and edges). I want to create a Python int
"Tamas Nepusz" <[EMAIL PROTECTED]> writes on 20 Oct 2005 15:39:54 -0700:
> The library I'm working on
> is designed for performing calculations on large-scale graphs (~1
> nodes and edges). I want to create a Python interface for that library,
> so what I want to accomplish is that I could just
Quoth "Tamas Nepusz" <[EMAIL PROTECTED]>:
| No, that's actually a bit more complicated. The library I'm working on
| is designed for performing calculations on large-scale graphs (~1
| nodes and edges). I want to create a Python interface for that library,
| so what I want to accomplish is that
No, that's actually a bit more complicated. The library I'm working on
is designed for performing calculations on large-scale graphs (~1
nodes and edges). I want to create a Python interface for that library,
so what I want to accomplish is that I could just type "from igraph
import *" in a Pyt
Tamas Nepusz wrote:
> Hi everyone,
>
> I have tried to do some googling before asking my question here, but I
> haven't found any suitable answer. I am developing a Python API for a
> graph library written in pure C. The library is doing an awful lot of
> math computations, and some of them can ta
Operation Latte Thunder wrote:
> I have a simple test proggie that isn't behaving like I expect ( found
> below ). The script will infinitely run ( as expected ), but seems to
> completely ignore control-C's. Shouldn't the interpreter pass along
> KeyboardInterrupts and break out of the while loo
41 matches
Mail list logo