comp.lang.python - 26 new messages in 7 topics - digest
comp.lang.python
http://groups.google.com/group/comp.lang.python?hl=en
comp.lang.python@googlegroups.com
Today's topics:
* Automation - 14 messages, 6 authors
http://groups.google.com/group/comp.lang.python/t/2cb5aaffece4c4a9?hl=en
* Python classes for reading/writing/parsing MIDI files - 2 messages, 2
authors
http://groups.google.com/group/comp.lang.python/t/1eb449bb19f0cf36?hl=en
* My first real request for help - 3 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/96fd5560416d3f90?hl=en
* Terry Jones: "Monty Python to reunite for stage show" - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/703fe365ac35e514?hl=en
* KeyboardInterrupt close failed in file object destructor: sys.excepthook is
missing lost sys.stderr - 3 messages, 3 authors
http://groups.google.com/group/comp.lang.python/t/63e2b796b3c778fd?hl=en
* Glade Survey - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/73ad3df8a1a9d356?hl=en
* Python 3.3.3 final - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/ffbe17db34fab23d?hl=en
==============================================================================
TOPIC: Automation
http://groups.google.com/group/comp.lang.python/t/2cb5aaffece4c4a9?hl=en
==============================================================================
== 1 of 14 ==
Date: Tues, Nov 19 2013 3:53 am
From: Walter Hurry
On Tue, 19 Nov 2013 21:48:10 +1100, Chris Angelico wrote:
> I guessed Scots for the second one because it
> didn't look Welsh and it seemed plausible to get a mostly-English
> paragraph with one Welsh name and one Scots word.
The word is *Scottish*. I think that's what Mark was driving at.
== 2 of 14 ==
Date: Tues, Nov 19 2013 3:58 am
From: Chris Angelico
On Tue, Nov 19, 2013 at 10:53 PM, Walter Hurry <walterhurry@lavabit.com> wrote:
> On Tue, 19 Nov 2013 21:48:10 +1100, Chris Angelico wrote:
>
>> I guessed Scots for the second one because it
>> didn't look Welsh and it seemed plausible to get a mostly-English
>> paragraph with one Welsh name and one Scots word.
>
> The word is *Scottish*. I think that's what Mark was driving at.
Oh. I've heard both, thought "Scots" was a valid term for the
language. My apologies. Scottish, then.
ChrisA
== 3 of 14 ==
Date: Tues, Nov 19 2013 4:36 am
From: Alister
On Tue, 19 Nov 2013 22:58:35 +1100, Chris Angelico wrote:
> On Tue, Nov 19, 2013 at 10:53 PM, Walter Hurry <walterhurry@lavabit.com>
> wrote:
>> On Tue, 19 Nov 2013 21:48:10 +1100, Chris Angelico wrote:
>>
>>> I guessed Scots for the second one because it didn't look Welsh and it
>>> seemed plausible to get a mostly-English paragraph with one Welsh name
>>> and one Scots word.
>>
>> The word is *Scottish*. I think that's what Mark was driving at.
>
> Oh. I've heard both, thought "Scots" was a valid term for the language.
> My apologies. Scottish, then.
>
> ChrisA
the language & nationality is Scottish, the people are Scots & Scotch is
a type of whisky.
--
You should never wear your best trousers when you go out to fight for
freedom and liberty.
-- Henrik Ibsen
== 4 of 14 ==
Date: Tues, Nov 19 2013 4:52 am
From: Chris Angelico
On Tue, Nov 19, 2013 at 11:36 PM, Alister <alister.ware@ntlworld.com> wrote:
> the language & nationality is Scottish, the people are Scots & Scotch is
> a type of whisky.
Hmm, I don't know that it's that clear-cut (other than the drink).
Derrick McClure is himself a Scot, and he posted this on Savoynet:
https://mailman.bridgewater.edu/pipermail/savoynet/2013-August/030264.html
Note his use of "Scots" to mean the language. Derrick, I'm cc'ing you
in on this: have I been led astray here by misreading your post?
ChrisA
== 5 of 14 ==
Date: Tues, Nov 19 2013 5:00 am
From: Alister
On Tue, 19 Nov 2013 23:52:09 +1100, Chris Angelico wrote:
> On Tue, Nov 19, 2013 at 11:36 PM, Alister <alister.ware@ntlworld.com>
> wrote:
>> the language & nationality is Scottish, the people are Scots & Scotch
>> is a type of whisky.
>
> Hmm, I don't know that it's that clear-cut (other than the drink).
> Derrick McClure is himself a Scot, and he posted this on Savoynet:
>
> https://mailman.bridgewater.edu/pipermail/savoynet/2013-
August/030264.html
>
> Note his use of "Scots" to mean the language. Derrick, I'm cc'ing you in
> on this: have I been led astray here by misreading your post?
>
> ChrisA
To be pedantic the language most Scots speak is English (or at least an
approximation there of)
--
Whom computers would destroy, they must first drive mad.
== 6 of 14 ==
Date: Tues, Nov 19 2013 4:59 am
From: Alister
On Tue, 19 Nov 2013 23:52:09 +1100, Chris Angelico wrote:
> On Tue, Nov 19, 2013 at 11:36 PM, Alister <alister.ware@ntlworld.com>
> wrote:
>> the language & nationality is Scottish, the people are Scots & Scotch
>> is a type of whisky.
>
> Hmm, I don't know that it's that clear-cut (other than the drink).
> Derrick McClure is himself a Scot, and he posted this on Savoynet:
>
> https://mailman.bridgewater.edu/pipermail/savoynet/2013-
August/030264.html
>
> Note his use of "Scots" to mean the language. Derrick, I'm cc'ing you in
> on this: have I been led astray here by misreading your post?
>
> ChrisA
To be pedantic the language most Scots speak is English (or at least an
approximation there of)
--
Whom computers would destroy, they must first drive mad.
== 7 of 14 ==
Date: Tues, Nov 19 2013 4:59 am
From: Alister
On Tue, 19 Nov 2013 23:52:09 +1100, Chris Angelico wrote:
> On Tue, Nov 19, 2013 at 11:36 PM, Alister <alister.ware@ntlworld.com>
> wrote:
>> the language & nationality is Scottish, the people are Scots & Scotch
>> is a type of whisky.
>
> Hmm, I don't know that it's that clear-cut (other than the drink).
> Derrick McClure is himself a Scot, and he posted this on Savoynet:
>
> https://mailman.bridgewater.edu/pipermail/savoynet/2013-
August/030264.html
>
> Note his use of "Scots" to mean the language. Derrick, I'm cc'ing you in
> on this: have I been led astray here by misreading your post?
>
> ChrisA
To be pedantic the language most Scots speak is English (or at least an
approximation there of)
--
Whom computers would destroy, they must first drive mad.
== 8 of 14 ==
Date: Tues, Nov 19 2013 5:00 am
From: Alister
On Tue, 19 Nov 2013 23:52:09 +1100, Chris Angelico wrote:
> On Tue, Nov 19, 2013 at 11:36 PM, Alister <alister.ware@ntlworld.com>
> wrote:
>> the language & nationality is Scottish, the people are Scots & Scotch
>> is a type of whisky.
>
> Hmm, I don't know that it's that clear-cut (other than the drink).
> Derrick McClure is himself a Scot, and he posted this on Savoynet:
>
> https://mailman.bridgewater.edu/pipermail/savoynet/2013-
August/030264.html
>
> Note his use of "Scots" to mean the language. Derrick, I'm cc'ing you in
> on this: have I been led astray here by misreading your post?
>
> ChrisA
To be pedantic the language most Scots speak is English (or at least an
approximation there of)
--
Whom computers would destroy, they must first drive mad.
== 9 of 14 ==
Date: Tues, Nov 19 2013 5:50 am
From: Mark Lawrence
On 19/11/2013 10:48, Chris Angelico wrote:
>
> Anyway, we Aussies know more about your geography than you know about
> ours, I reckon. Which of these is not a real place: Parramatta,
> Warrnambool, Cerinabbin, Mordialloc? No fair Googling them, see if you
> can call it. I've been to three of the above places, the other one
> came up in a fantasy name generator.
>
> Okay, maybe that's not exactly fair, but I'd still be curious to know
> how many of you know Aussie place names :)
>
An interesting comparison as your country is slightly larger than ours,
but I suspect we've actually many more place names. Still with no
search engine at all, I've heard of Parramatta so they must have one or
more sports teams, so sticking a pin onto my screen I'll guess at
Cerinabbin, close or must try harder?
--
Python is the second best programming language in the world.
But the best has yet to be invented. Christian Tismer
Mark Lawrence
== 10 of 14 ==
Date: Tues, Nov 19 2013 5:55 am
From: Tim Golden
On 19/11/2013 13:50, Mark Lawrence wrote:
> On 19/11/2013 10:48, Chris Angelico wrote:
>>
>> Anyway, we Aussies know more about your geography than you know about
>> ours, I reckon. Which of these is not a real place: Parramatta,
>> Warrnambool, Cerinabbin, Mordialloc? No fair Googling them, see if you
>> can call it. I've been to three of the above places, the other one
>> came up in a fantasy name generator.
I thought that's how they came up with Australian place names normally?
TJG
== 11 of 14 ==
Date: Tues, Nov 19 2013 6:07 am
From: Mark Lawrence
On 19/11/2013 13:55, Tim Golden wrote:
> On 19/11/2013 13:50, Mark Lawrence wrote:
>> On 19/11/2013 10:48, Chris Angelico wrote:
>>>
>>> Anyway, we Aussies know more about your geography than you know about
>>> ours, I reckon. Which of these is not a real place: Parramatta,
>>> Warrnambool, Cerinabbin, Mordialloc? No fair Googling them, see if you
>>> can call it. I've been to three of the above places, the other one
>>> came up in a fantasy name generator.
>
> I thought that's how they came up with Australian place names normally?
>
> TJG
>
Thinking about it perhaps "fantasy name generator" is a modern day,
politically correct term for an Aussie who's had too many beers? That
would put the question above firmly into context.
--
Python is the second best programming language in the world.
But the best has yet to be invented. Christian Tismer
Mark Lawrence
== 12 of 14 ==
Date: Tues, Nov 19 2013 6:08 am
From: Chris Angelico
On Wed, Nov 20, 2013 at 12:55 AM, Tim Golden <mail@timgolden.me.uk> wrote:
> On 19/11/2013 13:50, Mark Lawrence wrote:
>> On 19/11/2013 10:48, Chris Angelico wrote:
>>>
>>> Anyway, we Aussies know more about your geography than you know about
>>> ours, I reckon. Which of these is not a real place: Parramatta,
>>> Warrnambool, Cerinabbin, Mordialloc? No fair Googling them, see if you
>>> can call it. I've been to three of the above places, the other one
>>> came up in a fantasy name generator.
>
> I thought that's how they came up with Australian place names normally?
Certainly not. The early white settlers had a very sophisticated
technique for naming places, and one that showed great respect for the
prior owners of the land: find the nearest person with darker skin
than yours, point to the surrounding area, and say "What's this place
called?". That's why most Australian place names translate to, in the
local language of the area, "Huh?" or "What do you mean?" or "I
haven't the faintest clue what you're talking about, old chap", or
occasionally "Place of the Elbow" or "Dung Heap" once they figured out
how easy these people were to troll.
No, the fantasy name generators are used in the US of A. And Canada
just picks someone else's place name and adds "-eh" to it.
ChrisA
== 13 of 14 ==
Date: Tues, Nov 19 2013 7:06 am
From: MRAB
On 19/11/2013 12:59, Alister wrote:
> On Tue, 19 Nov 2013 23:52:09 +1100, Chris Angelico wrote:
>
>> On Tue, Nov 19, 2013 at 11:36 PM, Alister <alister.ware@ntlworld.com>
>> wrote:
>>> the language & nationality is Scottish, the people are Scots & Scotch
>>> is a type of whisky.
>>
>> Hmm, I don't know that it's that clear-cut (other than the drink).
>> Derrick McClure is himself a Scot, and he posted this on Savoynet:
>>
>> https://mailman.bridgewater.edu/pipermail/savoynet/2013-
> August/030264.html
>>
>> Note his use of "Scots" to mean the language. Derrick, I'm cc'ing you in
>> on this: have I been led astray here by misreading your post?
>>
>> ChrisA
>
> To be pedantic the language most Scots speak is English (or at least an
> approximation there of)
>
You need to distinguish between "Scottish English" and "Scots", the
latter being related to English, but isn't English, much as Danish is
related to Swedish, but isn't Swedish.
== 14 of 14 ==
Date: Tues, Nov 19 2013 7:11 am
From: Chris Angelico
On Wed, Nov 20, 2013 at 2:06 AM, MRAB <python@mrabarnett.plus.com> wrote:
> You need to distinguish between "Scottish English" and "Scots", the
> latter being related to English, but isn't English, much as Danish is
> related to Swedish, but isn't Swedish.
Ah. When I referred to a "Scots" word, I was talking about the Gaelic
language, which has a number of delightfully expressive terms just
waiting to be borrowed!
ChrisA
==============================================================================
TOPIC: Python classes for reading/writing/parsing MIDI files
http://groups.google.com/group/comp.lang.python/t/1eb449bb19f0cf36?hl=en
==============================================================================
== 1 of 2 ==
Date: Tues, Nov 19 2013 5:50 am
From: Annmarina Nagy
the command label gets "stuck"
== 2 of 2 ==
Date: Tues, Nov 19 2013 6:12 am
From: Chris Angelico
On Wed, Nov 20, 2013 at 12:50 AM, Annmarina Nagy <anagy4698@gmail.com> wrote:
> the command label gets "stuck"
A bit of context would help hugely. Are you replying to someone else's
post? All we have is a subject line.
ChrisA
==============================================================================
TOPIC: My first real request for help
http://groups.google.com/group/comp.lang.python/t/96fd5560416d3f90?hl=en
==============================================================================
== 1 of 3 ==
Date: Tues, Nov 19 2013 6:02 am
From: Gene Heskett
On Tuesday 19 November 2013 08:51:09 Albert Dengg did opine:
> On Tue, Nov 19, 2013 at 04:31:15AM -0500, Gene Heskett wrote:
> ...
>
> > But when I switch in, as one of the plugins a new .py version of
> > camview- emc, I get this when I attempt to run linuxcnc -l, where the
> > -l is "use the same config as last time" option.
> >
> > Starting LinuxCNC...
> >
> > Traceback (most recent call last):
> > File "/usr/bin/axis", line 3326, in <module>
> >
> > _dynamic_tabs(inifile)
> >
> > File "/usr/bin/axis", line 3182, in _dynamic_tabs
> >
> > child = Popen(cmd)
> >
> > File "/usr/lib/python2.6/subprocess.py", line 633, in __init__
> >
> > errread, errwrite)
> >
> > File "/usr/lib/python2.6/subprocess.py", line 1139, in
> > _execute_child
> >
> > raise child_exception
> >
> > OSError: [Errno 2] No such file or directory
> >
> > No clue, even when straced, as to what file might be missing.
> >
> > So, how do I find out?
>
> have you tried strace -e open -ff -ofile.log ?
> (it is easy to miss something in the strace output & and with -ff you
> also get subprocesses (in their own files, file.log.pid1,
> file.log.pid2,...)
>
The man page for strace, doesn't point that out, at least clear enough to
get my attention.
Thank you very much. I will do that, done. Got another error on the
terminal, something about the module helper not being setuid root.
module_helper is not setuid root
Realtime system did not load
This is associated with the expanded control strace now has, it is not
present otherwise.
And about 150 file.log.pid's. :) That should take a while to read.
> this however, does not really look like a python problem, as from the
> look of it it misses some external executable it tries to Popen()
Hopefully I will find a clue. Thanks again.
> so, you should probably on some linuxcnc/camview-emc related mailling
> list/forum.
>
> regards,
> albert
>
> ps: a more descriptive subject line would be helpfull for people to
> recognize what your post is about and then can quickly decide if they
> want to look at it or not.
Cheers, Gene
--
"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
How should I know if it works? That's what beta testers are for. I
only coded it.
-- Attributed to Linus Torvalds, somewhere in a posting
A pen in the hand of this president is far more
dangerous than 200 million guns in the hands of
law-abiding citizens.
== 2 of 3 ==
Date: Tues, Nov 19 2013 7:54 am
From: Gene Heskett
On Tuesday 19 November 2013 10:10:31 Gene Heskett did opine:
> On Tuesday 19 November 2013 08:51:09 Albert Dengg did opine:
> > On Tue, Nov 19, 2013 at 04:31:15AM -0500, Gene Heskett wrote:
> > ...
> >
> > > But when I switch in, as one of the plugins a new .py version of
> > > camview- emc, I get this when I attempt to run linuxcnc -l, where
> > > the -l is "use the same config as last time" option.
> > >
> > > Starting LinuxCNC...
> > >
> > > Traceback (most recent call last):
> > > File "/usr/bin/axis", line 3326, in <module>
> > >
> > > _dynamic_tabs(inifile)
> > >
> > > File "/usr/bin/axis", line 3182, in _dynamic_tabs
> > >
> > > child = Popen(cmd)
> > >
> > > File "/usr/lib/python2.6/subprocess.py", line 633, in __init__
> > >
> > > errread, errwrite)
> > >
> > > File "/usr/lib/python2.6/subprocess.py", line 1139, in
> > > _execute_child
> > >
> > > raise child_exception
> > >
> > > OSError: [Errno 2] No such file or directory
> > >
> > > No clue, even when straced, as to what file might be missing.
> > >
> > > So, how do I find out?
> >
> > have you tried strace -e open -ff -ofile.log ?
> > (it is easy to miss something in the strace output & and with -ff you
> > also get subprocesses (in their own files, file.log.pid1,
> > file.log.pid2,...)
>
> The man page for strace, doesn't point that out, at least clear enough
> to get my attention.
>
> Thank you very much. I will do that, done. Got another error on the
> terminal, something about the module helper not being setuid root.
>
> module_helper is not setuid root
> Realtime system did not load
>
> This is associated with the expanded control strace now has, it is not
> present otherwise.
>
> And about 150 file.log.pid's. :) That should take a while to read.
I went thru all of those with seeing anything but strace throwing away a
suid on a module owned by root that does a setuid $user, then complaining
about it. So I wiped that, then added sudo in front. That never exited
but went through all the motions, so I rebooted and did a cat file.log.*|
less, again without finding a smoking gun. The call to the starter script,
a .py, never made it into these logs according to grep. There was lots of
screeching because the sudo (root) environment was so different seems to be
the take away. It also chowned some stuff in my home dir.
So while I've learned another way not to make a light bulb, its still dark
here. AFAIK there is no camview-emc list, only the linuxcnc list, and this
is a case of maybe 3 people including me doing this, all of them far more
fluent in the various languages involved than I am. But lots will be using
this once we get it to the It Just Works(TM) stage.
What I want to do is cut steel, or in this case, pcb's that doesn't involve
a lot of pallet making, contact installation in the pallet, a half dozen
tool changes that require machine recalibration subroutines to be run, and
math to get a hole drilled halfway thru the board from one side, to exactly
register and meet that same hole when its turned over and drilled from the
other side.
>
The url I am working from:
<http://wiki.linuxcnc.org/cgi-bin/wiki.pl?Adding_Digital_Zoom_To_Camview-
Emc>
If I switch the invocation to use an older version of camunits-emc, I am
now seeing an error in the terminal I have not seen before.
** (camview-emc:1653): WARNING **: /usr/local/lib/camunits/halio.so:
undefined symbol: gluOrtho2D
And I'm not sure how to fix that either, it was not an error yesterday.
Thank you.
Cheers, Gene
--
"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
<woot> Put *that* in you .sig and smoke it, Knghtbrd.
<Culus> You know he will read this :>
<woot> heheheheh.
A pen in the hand of this president is far more
dangerous than 200 million guns in the hands of
law-abiding citizens.
== 3 of 3 ==
Date: Tues, Nov 19 2013 8:19 am
From: Gene Heskett
On Tuesday 19 November 2013 11:16:10 Peter Otten did opine:
> Gene Heskett wrote:
> > Old python, 2.6.4 I believe, not update able from the Ubuntu 10.04.3
> > LTS repo's.
> >
> > Should be a mauchs nichs as the code was written on, and is running
> > on, several of these same linuxcnc installs.
> >
> > But when I switch in, as one of the plugins a new .py version of
> > camview- emc, I get this when I attempt to run linuxcnc -l, where the
> > -l is "use the same config as last time" option.
> >
> > Starting LinuxCNC...
> >
> > Traceback (most recent call last):
> > File "/usr/bin/axis", line 3326, in <module>
> >
> > _dynamic_tabs(inifile)
> >
> > File "/usr/bin/axis", line 3182, in _dynamic_tabs
> >
> > child = Popen(cmd)
> >
> > File "/usr/lib/python2.6/subprocess.py", line 633, in __init__
> >
> > errread, errwrite)
> >
> > File "/usr/lib/python2.6/subprocess.py", line 1139, in
> > _execute_child
> >
> > raise child_exception
> >
> > OSError: [Errno 2] No such file or directory
> >
> > No clue, even when straced, as to what file might be missing.
> >
> > So, how do I find out?
>
> How about inserting a
>
> print cmd
>
> before the line
>
> child = Popen(cmd)
>
> ? Depending on its value it may not even be a missing command, e. g.
> This doesn't work:
>
> Python 2.6.7 (r267:88850, Sep 28 2012, 16:26:39)
> [GCC 4.6.1] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>
> >>> import subprocess
> >>> subprocess.Popen("ls -1")
>
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/usr/lib/python2.6/subprocess.py", line 623, in __init__
> errread, errwrite)
> File "/usr/lib/python2.6/subprocess.py", line 1141, in _execute_child
> raise child_exception
> OSError: [Errno 2] No such file or directory
>
> But this works:
> >>> subprocess.Popen(["ls", "-1"])
>
> <subprocess.Popen object at 0x7f8b31c5cfd0>
>
> >>> alpha
>
> beta
> gamma
>
> And this works, too (but is a bit less robust):
>
> subprocess.Popen("ls -1", shell=True)
> <subprocess.Popen object at 0x7f8b31c5cd90>
>
> >>> alpha
>
> beta
> gamma
You are suggesting I edit /usr/lib/python2.6/subprocess.py?
Thanks.
Cheers, Gene
--
"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
I have great faith in fools -- self confidence my friends call it.
-- Edgar Allan Poe
A pen in the hand of this president is far more
dangerous than 200 million guns in the hands of
law-abiding citizens.
==============================================================================
TOPIC: Terry Jones: "Monty Python to reunite for stage show"
http://groups.google.com/group/comp.lang.python/t/703fe365ac35e514?hl=en
==============================================================================
== 1 of 1 ==
Date: Tues, Nov 19 2013 6:08 am
From: Thomas Heller
"All of the surviving members of comedy group Monty Python are to reform
for a stage show, one of the Pythons, Terry Jones, has confirmed."
See: http://www.bbc.co.uk/news/entertainment-arts-24999401
Thomas
==============================================================================
TOPIC: KeyboardInterrupt close failed in file object destructor: sys.
excepthook is missing lost sys.stderr
http://groups.google.com/group/comp.lang.python/t/63e2b796b3c778fd?hl=en
==============================================================================
== 1 of 3 ==
Date: Tues, Nov 19 2013 7:35 am
From: Jai
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
return pos
def sentence_splitter(filename):
f = open(filename, "r")
for line in f:
line = line.strip()
print line + "\n"
while line:
pos = find_position(line)
line2 = line[ : pos+1].split(" ")
length = len(line2)
last_word = line2[length -1]
try:
if re.search(r"[A-Z]+.*", last_word) or line[pos+1] != " " or line[pos+2].islower() :
print line[:pos+1],
line = line[pos+1:]
else:
print line[ : pos+1]
line = line[pos+1 :]
except :
print " error here!!"
f.close()
return " bye bye"
if __name__=="__main__":
print sentence_splitter(sys.argv[1])
##########################3
exicution
python sentence_splitter6.py README | more
###############
README
Mr. Smith bought example.cheapsite.com for 1.5 million dollars, i.e. he paid a lot for it. Did he mind? Adam Jones Jr. thinks he didn't. In any case, this isn't true... Well, with a probability of .9 it isn't. The result should be:
~
############################
output
Mr. Smith bought example.cheapsite.com for 1.5 million dollars, i.e. he paid a lot for it. Did he mind? Adam Jones Jr. thinks he didn't.
In any case, this isn't true... Well, with a probability of .9 it isn't. The result should be:
Mr. Smith bought example. cheapsite. com for 1. 5 million dollars, i. e. he paid a lot for it.
Did he mind?
Adam Jones Jr. thinks he didn't.
In any case, this isn't true...
Well, with a probability of . 9 it isn't.
##########################################################3
error
KeyboardInterrupt
close failed in file object destructor:
sys.excepthook is missing
lost sys.stderr
##########################################
please help what is this i have try lot but unable to remove it
== 2 of 3 ==
Date: Tues, Nov 19 2013 8:08 am
From: Mark Lawrence
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
> return pos
>
> def sentence_splitter(filename):
>
> f = open(filename, "r")
>
> for line in f:
> line = line.strip()
> print line + "\n"
> while line:
> pos = find_position(line)
> line2 = line[ : pos+1].split(" ")
> length = len(line2)
> last_word = line2[length -1]
>
> try:
> if re.search(r"[A-Z]+.*", last_word) or line[pos+1] != " " or line[pos+2].islower() :
> print line[:pos+1],
> line = line[pos+1:]
> else:
> print line[ : pos+1]
> line = line[pos+1 :]
> except :
> print " error here!!"
>
> f.close()
> return " bye bye"
>
> if __name__=="__main__":
> print sentence_splitter(sys.argv[1])
>
> ##########################3
>
> exicution
>
> python sentence_splitter6.py README | more
>
> ###############
>
> README
>
> Mr. Smith bought example.cheapsite.com for 1.5 million dollars, i.e. he paid a lot for it. Did he mind? Adam Jones Jr. thinks he didn't. In any case, this isn't true... Well, with a probability of .9 it isn't. The result should be:
> ~
> ############################
>
> output
>
> Mr. Smith bought example.cheapsite.com for 1.5 million dollars, i.e. he paid a lot for it. Did he mind? Adam Jones Jr. thinks he didn't.
> In any case, this isn't true... Well, with a probability of .9 it isn't. The result should be:
>
> Mr. Smith bought example. cheapsite. com for 1. 5 million dollars, i. e. he paid a lot for it.
> Did he mind?
> Adam Jones Jr. thinks he didn't.
> In any case, this isn't true...
> Well, with a probability of . 9 it isn't.
>
> ##########################################################3
>
> error
>
> KeyboardInterrupt
> close failed in file object destructor:
> sys.excepthook is missing
> lost sys.stderr
>
> ##########################################
>
> please help what is this i have try lot but unable to remove it
>
Please help us to help you by stating your OS and Python versions.
Remove that dreadful bare exception which is masking everything in the
try block that could possibly go wrong, rerun your code and see what
happens. If you get a traceback display all of it for us to see via cut
and paste, don't paraphrase.
Finally the obligatory request for google users, would you please read
and action this https://wiki.python.org/moin/GoogleGroupsPython to
prevent us seeing potential double line spacing, thanks.
--
Python is the second best programming language in the world.
But the best has yet to be invented. Christian Tismer
Mark Lawrence
== 3 of 3 ==
Date: Tues, Nov 19 2013 8:42 am
From: Neil Cerutti
MOn Tue, Nov 19, 2013 at 10:35 AM, Jai
<jaiprakashsingh213@gmail.com> 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"[.?!]+", line).group()
> pos = line.find(pun)
> pos = pos+len(pun)-1
> return pos
When your search fails, this function will return 0. Fix that.
In general your problem isn't well defined enough for me to make
sense of your algorithm. Can you show sample input and output?
Can you describe the algorithm in plain English?
--
Neil Cerutti
==============================================================================
TOPIC: Glade Survey
http://groups.google.com/group/comp.lang.python/t/73ad3df8a1a9d356?hl=en
==============================================================================
== 1 of 2 ==
Date: Tues, Nov 19 2013 7:28 am
From: Juan Pablo Ugarte
On Mon, 2013-11-18 at 21:12 -0500, Gene Heskett wrote:
[...]
> > Invalid in what way? It looks fine to me. Or is it that you don't
> > trust its signer?
> >
> > ChrisA
>
> Firefox barked at me. So I backed away. And now it works. Phase of moon
> sensitive? Chew in wrong side of mouth? Or you fixed it. :)
:) I did not fix anything, do you remember the exact warning?
cheers
JP
== 2 of 2 ==
Date: Tues, Nov 19 2013 7:57 am
From: Gene Heskett
On Tuesday 19 November 2013 10:56:49 Juan Pablo Ugarte did opine:
> On Mon, 2013-11-18 at 21:12 -0500, Gene Heskett wrote:
> [...]
>
> > > Invalid in what way? It looks fine to me. Or is it that you don't
> > > trust its signer?
> > >
> > > ChrisA
> >
> > Firefox barked at me. So I backed away. And now it works. Phase of
> > moon sensitive? Chew in wrong side of mouth? Or you fixed it. :)
> :
> :) I did not fix anything, do you remember the exact warning?
>
Something about an expired certificate, but not the exact message. Sorry.
> cheers
>
> JP
Cheers, Gene
--
"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
In Nature there are neither rewards nor punishments, there are
consequences.
-- R. G. Ingersoll
A pen in the hand of this president is far more
dangerous than 200 million guns in the hands of
law-abiding citizens.
==============================================================================
TOPIC: Python 3.3.3 final
http://groups.google.com/group/comp.lang.python/t/ffbe17db34fab23d?hl=en
==============================================================================
== 1 of 1 ==
Date: Tues, Nov 19 2013 8:14 am
From: Mark Lawrence
On 19/11/2013 06:59, Georg Brandl wrote:
>
> To download Python 3.3.3 rc2 visit:
>
> http://www.python.org/download/releases/3.3.3/
>
Please make your mind up, final or rc2?
Thanks everybody for your efforts, much appreciated :)
--
Python is the second best programming language in the world.
But the best has yet to be invented. Christian Tismer
Mark Lawrence
==============================================================================
You received this message because you are subscribed to the Google Groups "comp.lang.python"
group.
To post to this group, visit http://groups.google.com/group/comp.lang.python?hl=en
To unsubscribe from this group, send email to comp.lang.python+unsubscribe@googlegroups.com
To change the way you get mail from this group, visit:
http://groups.google.com/group/comp.lang.python/subscribe?hl=en
To report abuse, send email explaining the problem to abuse@googlegroups.com
==============================================================================
Google Groups: http://groups.google.com/?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home