Python RPM distribution with altinstall on Centos 5

2013-11-19 Thread thomas . lehmann
Hi all,

I missed to find a Python 2.7.6 Centos 5 distribution.
Here's what I planned to do:

 - building from source on Centos 5 in a chroot (is working fine)
 - using "sudo make altinstall" (is working fine)

But ...

 - I want to build this via Jenkins (we have this kind of chroot
   build's still in place)
 - how to create a RPM for this concrete Centos 5 - Python version
   with the "altinstall" feature? (!! we require this !!)

Maybe you also have another idea on how to solve this 

Kind Regards,
Thomas
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: If you continue being rude i will continue doing this

2013-11-19 Thread Gregory Ewing

Ferrous Cranus wrote:

Trying to figure out how to install-setup EPEL repository along with python3 &&
python3-pip and 2 extra modules my script needed in my new VPS have costed 4-5
of my life and of my mental health, while if you just helped a bit these would
have been done in a couple of hours.


That's by no means certain. Often, problems like that can
only be solved by someone sitting in front of the system
in question and poking around in it.

Debugging obscure problems remotely via usenet is extremely
difficult, and it's even more difficult if the question
essentially just consists of "This doesn't work, please
help me!".

If you don't get a response to a question like that, it's
not because people are refusing to help. It's because
nobody happens to have seen that exact set of symptoms
before, so without further information, they *can't*
help.

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list


Re: If you continue being rude i will continue doing this

2013-11-19 Thread alex23

On 19/11/2013 2:15 AM, Ferrous Cranus wrote:
[...]

Any chance you could stop acting like a troll and generating new email 
addresses in an apparent attempt to get around people's filters?


You claim you're acting in good faith, so stop appearing to do otherwise.
--
https://mail.python.org/mailman/listinfo/python-list


Re: Automation

2013-11-19 Thread Ian Kelly
On Fri, Nov 15, 2013 at 1:45 PM, Alister  wrote:
> and if you haven't seen it before :-
>
> Aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it deosn't mttaer in
> waht oredr the ltteers in a wrod are, the olny iprmoetnt tihng is taht
> the frist and lsat ltteer be at the rghit pclae. The rset can be a toatl
> mses and you can sitll raed it wouthit porbelm. Tihs is bcuseae the huamn
> mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe.

And the obligatory response:

Iltnsegnetiry I'm sdutynig tihs crsrootaivnel pnoheenmon at the
Dptmnearet of Liuniigctss at Absytrytewh Uivsreitny and my
exartrnairdoy doisiervecs waleoetderhlhy cndairotct the picsbeliud
fdnngiis rrgdinaeg the rtlvaeie dfuictlify of ialtnstny ttalrisanng
sentences. My rsceeerhars deplveeod a cnionevent ctnoiaptorn at
hnasoa/tw.nartswdbvweos/utrtek:p./il taht dosnatterems that the
hhpsteyios uuiqelny wrtaarns criieltidby if the aoussmpitn that the
prreoecandpne of your wrods is not eendetxd is uueniqtolnabse.
Aoilegpos for aidnoptg a cdocianorttry vwpiienot but, ttoheliacrley
spkeaing, lgitehnneng the words can mnartafucue an iocnuurgons
samenttet that is vlrtiauly isbpilechmoenrne.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Not my fault

2013-11-19 Thread rurpy
On 11/18/2013 07:30 AM, Ferrous Cranus wrote:
>[...]
> No i haven't broke it at all. Everything work as they should.
> 
> The refusal of 'pygeoip' to install turned out to be the local
> setting in my new VPS.
> 
> So i have changes it to:
> 
> export LANG = en_US.UTF-8
> 
> and then 'pip install pygeoip' was successful.
> 
> Trying to figure out how to install-setup EPEL repository along with
> python3 && python3-pip and 2 extra modules my script needed in my new
> VPS have costed 4-5 of my life and of my mental health, while if you
> just helped a bit these would have been done in a couple of hours.

Someone might have helped if you hadn't posted all
those messages, which I and most people saw as pretty
hostile. 

But regardless of that, I'm, glad you found the solution
and thanks for posting it here.  It would not have occurred
to me that that would have been the problem, so it is
useful for the rest of us to know for the future.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: If you continue being rude i will continue doing this

2013-11-19 Thread rurpy
On Monday, November 18, 2013 7:24:53 AM UTC-7, Piet van Oostrum wrote:
> Ferrous Cranus  writes:
> > No i haven't broke it at all.
> > Everything work as they should.
> > The refusal of 'pygeoip' to install turned out to be the local setting in 
> > my new VPS.
> > So i have changes it to:
> > export LANG = en_US.UTF-8
> > and then 'pip install pygeoip' was successful. 
> > Trying to figure out how to install-setup EPEL repository along with> 
> > python3 && python3-pip and 2 extra modules my script needed in my new
> > VPS have costed 4-5 of my life and of my mental health, while if you
> > just helped a bit these would have been done in a couple of hours.
> 
> How could anyone have known that this was the problem? AFIAK you
> didn't even tell about the VPS. And moreover this wasn't a Python
> problem, so off topic here.

It was an obscure error message produced by a python installer
when trying to install a python package.  It certainly is on topic. 

Please don't set up different standards for posters you don't
like -- others who don't know better might understandably think
they apply to everyone.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Oh look, another language (ceylon)

2013-11-19 Thread wxjmfauth
Le lundi 18 novembre 2013 14:31:33 UTC+1, Steven D'Aprano a écrit :
> 
> 
> ...   choose one of the three bad choices:  ...
> 
> 
> 
> * choose UTF-16 or UTF-8, and have O(n) primitive string operations (like 
> 
> Haskell and, apparently, Ceylon);
> 
> 
> 
> * or UTF-16 without support for the supplementary planes (which makes it 
> 
> virtually UCS-2), like Javascript;
> 
> 
> 
> * choose UTF-32, and use two or four times as much memory as needed.
> 
> 
> 

Nothing can beat the coding schemes endorsed by Unicode.

They are all working on the smallest possible entity
level (Unicode Transformation *Units*) with a unique
set of these entities.

To not forget. A set of characters is an artificial
construction and by nature it can not follow the
logic of a more "natural" set, eg. integers.

jmf

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Automation

2013-11-19 Thread Chris Angelico
On Tue, Nov 19, 2013 at 7:53 PM, Ian Kelly  wrote:
> Aoilegpos for aidnoptg a cdocianorttry vwpiienot but, ttoheliacrley
> spkeaing, lgitehnneng the words can mnartafucue an iocnuurgons
> samenttet that is vlrtiauly isbpilechmoenrne.

isbpilechmoenrne. I totally want to find an excuse to use that word
somewhere.. It just looks awesome.

Paradoxically, it's actually more likely that a computer can figure
out what you're saying here. In fact, I could easily write a little
script that reads /usr/share/dict/words (or equivalent) and attempts
to decode your paragraph. Hmm. You know what, I think I will. It's now
0958 UTC, let's see how long this takes me.

Meh. I did something stupid and decided to use a regular expression.
It's not 1020 UTC, so that's 21 minutes of figuring out what I was
doing wrong with the regex and 1 minute solving the original problem.
But here's your translated paragraph:

-- cut --
Interestingly I'm studying this controversial phenomenon at the
Department of Linguistics at Absytrytewh University and my
extraordinary discoveries wholeheartedly contradict the picsbeliud
findings regarding the relative difficulty of instantly translating
sentences. My researchers developed a convenient contraption at
hnasoa/tw.nartswdbvweos/utrtek:p./il that demonstrates that the
hypothesis uniquely warrants credibility if the assumption that the
preponderance of your words is not extended is unquestionable.
Apologies for adopting a contradictory viewpoint but, theoretically
speaking, lengthening the words can manufacture an incongruous
statement that is virtually incomprehensible.
-- cut --

It couldn't figure out "Absytrytewh", "picsbeliud", or
"hnasoa/tw.nartswdbvweos/utrtek:p./il". That's not a bad result. (And
as a human, I'm guessing that the second one isn't an English word -
maybe it's Scots?) Here's the code:

words = {}
for word in open("/usr/share/dict/words"):
word=word.strip().lower()
transformed = word if len(word)==1 else
word[0]+''.join(sorted(word[1:-1]))+word[-1]
words.setdefault(transformed,set()).add(word)
words.setdefault(transformed.capitalize(),set()).add(word.capitalize())

import re
for line in open("input"):
line=line.strip()
for word in re.split("(\W+)",line):
try:
transformed = word if len(word)==1 else
word[0]+''.join(sorted(word[1:-1]))+word[-1]
realword=words[transformed]
if len(realword)>1: realword=repr(realword)
else: realword=next(iter(realword))
line=line.replace(word,realword)
except LookupError: # catches three errors, all of which mean
we shouldn't translate anything
pass
print(line)


Yeah, it's not the greatest code, but it works :)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


My first real request for help

2013-11-19 Thread Gene Heskett
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 
_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?

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)

 abuse me.  I'm so lame I sent a bug report to debian-devel-changes
-- Seen on #Debian
A pen in the hand of this president is far more
dangerous than 200 million guns in the hands of
 law-abiding citizens.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Using try-catch to handle multiple possible file types?

2013-11-19 Thread Mark Lawrence

On 19/11/2013 07:13, Victor Hooi wrote:


So basically, using exception handling for flow-control.

However, is that considered bad practice, or un-Pythonic?



If it works for you use it, practicality beats purity :)

--
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list


Re: Automation

2013-11-19 Thread Ian Kelly
On Tue, Nov 19, 2013 at 2:26 AM, Chris Angelico  wrote:
> It couldn't figure out "Absytrytewh", "picsbeliud", or
> "hnasoa/tw.nartswdbvweos/utrtek:p./il". That's not a bad result. (And
> as a human, I'm guessing that the second one isn't an English word -
> maybe it's Scots?) Here's the code:

It's been posted widely on the Internet, and you can probably find the
full solution by googling it up.  For now, I'll just leave the hints
that the name of the university is Welsh, and that the second word
above is spelled in the British way, which is probably why your script
couldn't find it in a dictionary.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Automation

2013-11-19 Thread Mark Lawrence

On 19/11/2013 08:53, Ian Kelly wrote:

On Fri, Nov 15, 2013 at 1:45 PM, Alister  wrote:

and if you haven't seen it before :-

Aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it deosn't mttaer in
waht oredr the ltteers in a wrod are, the olny iprmoetnt tihng is taht
the frist and lsat ltteer be at the rghit pclae. The rset can be a toatl
mses and you can sitll raed it wouthit porbelm. Tihs is bcuseae the huamn
mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe.


And the obligatory response:

Iltnsegnetiry I'm sdutynig tihs crsrootaivnel pnoheenmon at the
Dptmnearet of Liuniigctss at Absytrytewh Uivsreitny and my
exartrnairdoy doisiervecs waleoetderhlhy cndairotct the picsbeliud
fdnngiis rrgdinaeg the rtlvaeie dfuictlify of ialtnstny ttalrisanng
sentences. My rsceeerhars deplveeod a cnionevent ctnoiaptorn at
hnasoa/tw.nartswdbvweos/utrtek:p./il taht dosnatterems that the
hhpsteyios uuiqelny wrtaarns criieltidby if the aoussmpitn that the
prreoecandpne of your wrods is not eendetxd is uueniqtolnabse.
Aoilegpos for aidnoptg a cdocianorttry vwpiienot but, ttoheliacrley
spkeaing, lgitehnneng the words can mnartafucue an iocnuurgons
samenttet that is vlrtiauly isbpilechmoenrne.



How did you get onto my system and steal my code, it's under copyright 
you know? :)


--
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list


Re: Automation

2013-11-19 Thread Mark Lawrence

On 19/11/2013 09:26, Chris Angelico wrote:


It couldn't figure out "Absytrytewh", "picsbeliud", or
"hnasoa/tw.nartswdbvweos/utrtek:p./il". That's not a bad result. (And
as a human, I'm guessing that the second one isn't an English word -
maybe it's Scots?) Here's the code:



I sense another letter to your Minister for Education regarding the 
teaching of Geography.  Fancy not recognising a well known UK place name 
when it's put right in front of you.  And Scots indeed, my mum will be 
turning in her grave :)


--
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list


Re: My first real request for help

2013-11-19 Thread Albert Dengg
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 
> _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,...)

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()

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.


signature.asc
Description: Digital signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: My first real request for help

2013-11-19 Thread Peter Otten
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 
> _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 "", line 1, in 
  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"])

>>> alpha
beta
gamma

And this works, too (but is a bit less robust):

subprocess.Popen("ls -1", shell=True)

>>> alpha
beta
gamma


-- 
https://mail.python.org/mailman/listinfo/python-list


How to catch error messages in ftplib?

2013-11-19 Thread JL
I have the following code;

try:
session = FTP(ftp_server_ip,ftp_user,ftp_password)
file = open(filename,'rb') # file to send
session.storbinary('STOR ' +  filename, file) # send the file
except Exception, errObj:
print Exception
print errObj
file.close() # close file and FTP
session.quit()

I deliberately placed an invalid ip address for the ftp_server_ip to see 
whether error messages can be caught. However, no exception was thrown. Can 
someone more experienced point to me what did I do wrong?

Thank you.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to catch error messages in ftplib?

2013-11-19 Thread JL
I repost the original code segment to make it more complete;

from ftplib import FTP
try:
session = FTP(ftp_server_ip,ftp_user,ftp_password)
file = open(filename,'rb') # file to send
session.storbinary('STOR ' +  filename, file) # send the file
except Exception, errObj:
print Exception
print errObj
file.close() # close file and FTP
session.quit()

On Tuesday, November 19, 2013 6:18:07 PM UTC+8, JL wrote:
> I have the following code;
> 
> 
> 
> try:
> 
> session = FTP(ftp_server_ip,ftp_user,ftp_password)
> 
> file = open(filename,'rb') # file to send
> 
> session.storbinary('STOR ' +  filename, file) # send the file
> 
> except Exception, errObj:
> 
> print Exception
> 
> print errObj
> 
> file.close() # close file and FTP
> 
> session.quit()
> 
> 
> 
> I deliberately placed an invalid ip address for the ftp_server_ip to see 
> whether error messages can be caught. However, no exception was thrown. Can 
> someone more experienced point to me what did I do wrong?
> 
> 
> 
> Thank you.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Automation

2013-11-19 Thread Chris Angelico
On Tue, Nov 19, 2013 at 8:54 PM, Mark Lawrence  wrote:
> On 19/11/2013 09:26, Chris Angelico wrote:
>>
>>
>> It couldn't figure out "Absytrytewh", "picsbeliud", or
>> "hnasoa/tw.nartswdbvweos/utrtek:p./il". That's not a bad result. (And
>> as a human, I'm guessing that the second one isn't an English word -
>> maybe it's Scots?) Here's the code:
>>
>
> I sense another letter to your Minister for Education regarding the teaching
> of Geography.  Fancy not recognising a well known UK place name when it's
> put right in front of you.  And Scots indeed, my mum will be turning in her
> grave :)

Oh, I recognized Aberystwyth (though I can't spell it without the help
of a search engine), it was the second I wasn't sure about. (Though
Ian was right - I was working with a limited dictionary, which is why
it didn't pick that one up.) 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.
Wrong, but hopefully not so implausibly wrong as to cause gyration of
the encephalographically-challenged.

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 :)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Automation

2013-11-19 Thread Chris Angelico
On Tue, Nov 19, 2013 at 8:54 PM, Mark Lawrence  wrote:
> On 19/11/2013 09:26, Chris Angelico wrote:
>>
>>
>> It couldn't figure out "Absytrytewh", "picsbeliud", or
>> "hnasoa/tw.nartswdbvweos/utrtek:p./il". That's not a bad result. (And
>> as a human, I'm guessing that the second one isn't an English word -
>> maybe it's Scots?) Here's the code:
>>
>
> I sense another letter to your Minister for Education regarding the teaching
> of Geography.  Fancy not recognising a well known UK place name when it's
> put right in front of you.  And Scots indeed, my mum will be turning in her
> grave :)

Oh, I think I see where the misunderstanding may have been. I said
"It" couldn't figure those out, meaning the script; one of them isn't
a word at all, another one is a place name (and therefore not in its
dictionary), and one happened to be a form of the word that it didn't
have (as it had the equivalent with a 'z'), and I wasn't able to
figure it out myself either. But I grokked the university's name no
trouble. No other university has that many y's and so few other
vowels. :)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to catch error messages in ftplib?

2013-11-19 Thread Chris Angelico
On Tue, Nov 19, 2013 at 9:18 PM, JL  wrote:
> I have the following code;
>
> try:
> session = FTP(ftp_server_ip,ftp_user,ftp_password)
> file = open(filename,'rb') # file to send
> session.storbinary('STOR ' +  filename, file) # send the file
> except Exception, errObj:
> print Exception
> print errObj
> file.close() # close file and FTP
> session.quit()
>
> I deliberately placed an invalid ip address for the ftp_server_ip to see 
> whether error messages can be caught. However, no exception was thrown. Can 
> someone more experienced point to me what did I do wrong?
>

My first suggestion would be to get rid of the try/except block - it's
not really helping you. Just let the exception be displayed. When I
try that, I get a variety of different errors, depending on what sort
of "invalid IP address" was used - if it's malformed
("192.168.1.2.3"), I get a DNS failure, if it's a computer that
doesn't exist but ought to be on my LAN ("192.168.0.2"), I get a
timeout, and if it's one that exists but doesn't have an FTP server
running ("192.168.0.3"), I get a connection refusal. Exactly what I'd
expect to see. Removing the try/except will show what's happening.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Several Topics - Nov. 19, 2013

2013-11-19 Thread E.D.G.
"E.D.G."  wrote in message 
news:ro-dnch2dptbrhnpnz2dnuvz_rsdn...@earthlink.com...

Posted by E.D.G. on November 19, 2013

1.  PERL PDL CALCULATION SPEED VERSUS PYTHON AND FORTRAN

2.  COMPUTER PROGRAMMING PROJECTS


PERL PDL CALCULATION SPEED VERSUS PYTHON AND FORTRAN

  This program translation project has become one of the most 
surprisingly successful programming projects I have worked on to date.  A 
considerable amount of valuable information has been sent to me by E-mail in 
addition to all of the information posted to the Newsgroups.


  The original posts actually discussed calculation speed matters 
involving Perl and Python.  And responses indicated that there were ways to 
develop routines that could dramatically accelerate Python calculations. 
But it did not sound like there were any for Perl.


However, a kind soul sent me the following references:

http://pdl.perl.org/
http://www.youtube.com/watch?v=IE-vnnRWiOg
http://www.youtube.com/watch?v=rf1yfZ2yUFo

  From what I can see, PDL represents a group of modules that can be 
linked with Perl to do faster calculations and to generate charts.  I gather 
that it converts calculations directly to the C language so that they run 
faster.  And now I am wondering how those calculations would compare with 
Python and Fortran and the other programs listed on the following Web page:


http://julialang.org/

  As soon as possible I am planning to give the PDL modules a try 
myself and see if they help with my present Perl calculation speed 
limitations.


  Does anyone have any comments they can add regarding PDL (for posting 
in the Perl Newsgroup)?


  Would those PDL modules be available on Internet Servers that let 
users develop and run Perl CGI programs?  Or would they need to be specially 
installed?



COMPUTER PROGRAMMING PROJECTS

  As most people visiting these Newsgroups probably know, computers run 
our world.  And therefore, computer programmers at least indirectly run our 
world.  As an experienced scientist who does some programming work I myself 
am fully aware of that.  But relatively few other scientists are.  And 
almost no government officials appear to be.  And they are the ones who have 
all of the money.


  As an experienced scientist I regularly send free technical advice to 
governments and nongovernmental organizations (NGOs) around the world 
regarding humanitarian projects.  Some of my past efforts have been highly 
successful.  And because I am so aware of the importance of computer 
programming to the success of most efforts I can be especially effective 
when discussing proposed projects.  I know enough about computer 
programming, electronics, and machine shop usage that I can provide the 
government officials with exact instructions for how they should proceed 
with developing some project.


  For example, sometimes the best way to get something done is with a 
specially designed electronic circuit.  At other times it is more efficient 
to use a microprocessor to do the data processing.


  There are several highly important computer programming intensive 
projects that I have been attempting to get our governments to develop for 
some time.  They are in my opinion needed by people around the world.  I 
have several Web sites that were created so that information could be easily 
circulated regarding those projects.  And as time permits I plan to start 
discussing them in various computer language Newsgroups.


  An effort is also in progress to get some modifications made to the 
U.S. Government Petitions Web Site so that it works a little better and is 
of more use to people.


https://petitions.whitehouse.gov/

 It has been my personal experience that our government officials who 
decide which projects should get funding and how many computer programmers 
etc. need to be hired for this or that effort usually know so little about 
the work that computer programmers and even scientists do that they often 
don't have any idea regarding how to solve various problems and also often 
don't even know that certain problems exist.


These are personal opinions.

--
https://mail.python.org/mailman/listinfo/python-list


Re: Automation

2013-11-19 Thread 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.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Automation

2013-11-19 Thread Chris Angelico
On Tue, Nov 19, 2013 at 10:53 PM, Walter Hurry  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
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Where to find pip3 for Python 3.3.2?

2013-11-19 Thread Ned Batchelder
On Monday, November 18, 2013 10:57:23 PM UTC-5, Tony the Tiger wrote:
> On Sun, 17 Nov 2013 11:22:05 +0200, Nikos wrote:
> 
> > python3.4 is gone at this stage. Now if i only could install pip for
> > Python 3.3.2
> 
> 
> 
> What are you? Some fucking moron? Multi-posting under different subjects 
> will only get you one thing: a one-way ticket to people's killfiles.
> 
> **PLONK**
> 
> See?

Please don't respond in this way.  It won't change the OP's behavior, it 
doesn't make this list a better place, and it runs contrary to the norms of the 
community: http://www.python.org/psf/codeofconduct.  

Ignoring the OP is the best chance we have of reducing this kind of noise.

Additionally, lately the OP has taken to aggressive off-list behavior, and you 
don't want to invite any of that.

I know it's difficult to stay quiet sometimes, but it really is the best path.  
Thanks.

--Ned.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Automation

2013-11-19 Thread Alister
On Tue, 19 Nov 2013 22:58:35 +1100, Chris Angelico wrote:

> On Tue, Nov 19, 2013 at 10:53 PM, Walter Hurry 
> 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
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Automation

2013-11-19 Thread Chris Angelico
On Tue, Nov 19, 2013 at 11:36 PM, Alister  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
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Automation

2013-11-19 Thread Alister
On Tue, 19 Nov 2013 23:52:09 +1100, Chris Angelico wrote:

> On Tue, Nov 19, 2013 at 11:36 PM, Alister 
> 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.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Automation

2013-11-19 Thread Alister
On Tue, 19 Nov 2013 23:52:09 +1100, Chris Angelico wrote:

> On Tue, Nov 19, 2013 at 11:36 PM, Alister 
> 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.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Automation

2013-11-19 Thread Alister
On Tue, 19 Nov 2013 23:52:09 +1100, Chris Angelico wrote:

> On Tue, Nov 19, 2013 at 11:36 PM, Alister 
> 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.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Automation

2013-11-19 Thread Alister
On Tue, 19 Nov 2013 23:52:09 +1100, Chris Angelico wrote:

> On Tue, Nov 19, 2013 at 11:36 PM, Alister 
> 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.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python classes for reading/writing/parsing MIDI files

2013-11-19 Thread Annmarina Nagy
 the command label gets "stuck"
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Automation

2013-11-19 Thread 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

--
https://mail.python.org/mailman/listinfo/python-list


Re: Automation

2013-11-19 Thread 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

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: My first real request for help

2013-11-19 Thread 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 
> >   
> > _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.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Automation

2013-11-19 Thread 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

--
https://mail.python.org/mailman/listinfo/python-list


Re: Automation

2013-11-19 Thread Chris Angelico
On Wed, Nov 20, 2013 at 12:55 AM, 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?

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
-- 
https://mail.python.org/mailman/listinfo/python-list


Terry Jones: "Monty Python to reunite for stage show"

2013-11-19 Thread 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
--
https://mail.python.org/mailman/listinfo/python-list


Re: Python classes for reading/writing/parsing MIDI files

2013-11-19 Thread Chris Angelico
On Wed, Nov 20, 2013 at 12:50 AM, Annmarina Nagy  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
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Automation

2013-11-19 Thread 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 
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.

--
https://mail.python.org/mailman/listinfo/python-list


Re: Automation

2013-11-19 Thread Chris Angelico
On Wed, Nov 20, 2013 at 2:06 AM, MRAB  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
-- 
https://mail.python.org/mailman/listinfo/python-list


KeyboardInterrupt close failed in file object destructor: sys.excepthook is missing lost sys.stderr

2013-11-19 Thread 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 





-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Glade Survey

2013-11-19 Thread 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


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: tcltk, python, xml, gtk problems

2013-11-19 Thread 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 
> > >   
> > > _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:


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)

 Put *that* in you .sig and smoke it, Knghtbrd.
 You know he will read this :>
 heheheheh.
A pen in the hand of this president is far more
dangerous than 200 million guns in the hands of
 law-abiding citizens.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Glade Survey

2013-11-19 Thread 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.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: KeyboardInterrupt close failed in file object destructor: sys.excepthook is missing lost sys.stderr

2013-11-19 Thread 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

--
https://mail.python.org/mailman/listinfo/python-list


Re: [RELEASED] Python 3.3.3 final

2013-11-19 Thread 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

--
https://mail.python.org/mailman/listinfo/python-list


Re: My first real request for help

2013-11-19 Thread 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 
> >   
> > _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 "", line 1, in 
>   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"])
> 
> 
> 
> >>> alpha
> 
> beta
> gamma
> 
> And this works, too (but is a bit less robust):
> 
> subprocess.Popen("ls -1", shell=True)
> 
> 
> >>> 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.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: KeyboardInterrupt close failed in file object destructor: sys.excepthook is missing lost sys.stderr

2013-11-19 Thread Neil Cerutti
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"[.?!]+", 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
-- 
https://mail.python.org/mailman/listinfo/python-list


how to get raw bytes for ctypes functions that return c_wchar_p

2013-11-19 Thread Mark Summerfield
Hi,

I am using ctypes to access a function in a DLL using Python 3.3 32-bit on 
Windows 7 64-bit:

dplGetPageText = dpl.DPLGetPageText
dplGetPageText.argtypes = (ctypes.c_int, ctypes.c_int)
dplGetPageText.restype = ctypes.c_wchar_p

Python returns this as a str with the raw bytes already decoded.

Unfortunately, when the returned text contains some special characters (e.g. © 
or fi) it is not encoded correctly. This may be a problem with Windows or with 
ctypes or with the library I'm using; or of course, it could be my own mistake. 

To find out, I'd like to change the restype to give me the raw bytes so that I 
can view them and if necessary decode them myself.

Can anyone tell me how to change the restype to get the bytes?

Thanks!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: My first real request for help

2013-11-19 Thread Tim Chase
On 2013-11-19 11:19, Gene Heskett wrote:
>>> Traceback (most recent call last):
>>>   File "/usr/bin/axis", line 3326, in 
>>>   
>>> _dynamic_tabs(inifile)
>>>   
>>>   File "/usr/bin/axis", line 3182, in _dynamic_tabs
>>>   
>>> child = Popen(cmd)
>
> You are suggesting I edit /usr/lib/python2.6/subprocess.py?

I think Peter is suggesting that line 3182 in _dynamic_tabs should
either read (the better way)

  child = Popen([cmd, args])

or (the not-so-good way)

  child = Popen(cmd, shell=True)

If you drop a breakpoint right before that line, you should be able
to tell what it's trying to pass into Popen:

  print("DEBUGGING: %s" % repr(cmd))
  child = Popen(...)

which should give you insight into what's being called.

-tkc


PS: yes, I know about using "%r" in the format string rather than
"%s" plus a repr() call, but weird things happen in the event that
the parameter is a tuple; it could also have been written

  print("DEBUGGING: %r" % (cmd,))

but I find that a tad uglier.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: My first real request for help

2013-11-19 Thread xDog Walker
On Tuesday 2013 November 19 08:19, Gene Heskett wrote:
> You are suggesting I edit /usr/lib/python2.6/subprocess.py?

You should use either

   subprocess.Popen(["ls", "-l"])
or   

   subprocess.Popen("ls -l")

The argument to the first is a two element list.   
The argument to the second is a string.  

You used "ls -l" as the process to run, thus 
" OSError: [Errno 2] No such file or directory"

See the subprocess documentation.
 
-- 
Yonder nor sorghum stenches shut ladle gulls stopper torque wet 
strainers.



-- 
https://mail.python.org/mailman/listinfo/python-list


Re: My first real request for help

2013-11-19 Thread Gene Heskett
On Tuesday 19 November 2013 12:12:49 Tim Chase did opine:

> On 2013-11-19 11:19, Gene Heskett wrote:
> >>> Traceback (most recent call last):
> >>>   File "/usr/bin/axis", line 3326, in 
> >>>   
> >>> _dynamic_tabs(inifile)
> >>>   
> >>>   File "/usr/bin/axis", line 3182, in _dynamic_tabs
> >>>   
> >>> child = Popen(cmd)
> > 
> > You are suggesting I edit /usr/lib/python2.6/subprocess.py?
> 
> I think Peter is suggesting that line 3182 in _dynamic_tabs should
> either read (the better way)

Now, this is a puzzle.
_dynamic_tabs is not a file in /usr/lib/python2.6, nor does it "grep" in 
that directory.

I need another clue, how much are they? :).
> 
>   child = Popen([cmd, args])
> 
> or (the not-so-good way)
> 
>   child = Popen(cmd, shell=True)
> 
> If you drop a breakpoint right before that line, you should be able
> to tell what it's trying to pass into Popen:
> 
>   print("DEBUGGING: %s" % repr(cmd))
>   child = Popen(...)
> 
> which should give you insight into what's being called.
> 
> -tkc
> 
> 
> PS: yes, I know about using "%r" in the format string rather than
> "%s" plus a repr() call, but weird things happen in the event that
> the parameter is a tuple; it could also have been written
> 
>   print("DEBUGGING: %r" % (cmd,))
> 
> but I find that a tad uglier.

Thanks Tim.

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)

Once I finally figured out all of life's answers, they changed the 
questions.
A pen in the hand of this president is far more
dangerous than 200 million guns in the hands of
 law-abiding citizens.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: how to get raw bytes for ctypes functions that return c_wchar_p

2013-11-19 Thread Thomas Heller

Am 19.11.2013 17:58, schrieb Mark Summerfield:

Hi,

I am using ctypes to access a function in a DLL using Python 3.3
32-bit on Windows 7 64-bit:

dplGetPageText = dpl.DPLGetPageText dplGetPageText.argtypes =
(ctypes.c_int, ctypes.c_int) dplGetPageText.restype =
ctypes.c_wchar_p

Python returns this as a str with the raw bytes already decoded.

Unfortunately, when the returned text contains some special
characters (e.g. © or fi) it is not encoded correctly. This may be a
problem with Windows or with ctypes or with the library I'm using; or
of course, it could be my own mistake.

To find out, I'd like to change the restype to give me the raw bytes
so that I can view them and if necessary decode them myself.

Can anyone tell me how to change the restype to get the bytes?


ctypes on Python 2.7 has the set_conversion_mode(coding, errors)
which could be used to change the way c_wchar_p is converted
from/to Python strings.
Unfortunately it seems to be gone in Python 3.3.

However, you can set restype to POINTER(c_char) and then
index the result:

result = dplGetPageText(...)
print(result[0], result[1], result[2])

Thomas
--
https://mail.python.org/mailman/listinfo/python-list


Re: My first real request for help

2013-11-19 Thread Tim Chase
On 2013-11-19 12:19, Gene Heskett wrote:
> > On 2013-11-19 11:19, Gene Heskett wrote:  
> > >>> Traceback (most recent call last):
> > >>>   File "/usr/bin/axis", line 3326, in 
> > >>>   
> > >>> _dynamic_tabs(inifile)
> > >>>   
> > >>>   File "/usr/bin/axis", line 3182, in _dynamic_tabs
> > >>>   
> > >>> child = Popen(cmd)  
> > > 
> > > You are suggesting I edit /usr/lib/python2.6/subprocess.py?  
> > 
> > I think Peter is suggesting that line 3182 in _dynamic_tabs should
> > either read (the better way)  
> 
> Now, this is a puzzle.
> _dynamic_tabs is not a file in /usr/lib/python2.6, nor does it
> "grep" in that directory.
> 
> I need another clue, how much are they? :).

Doh, I misread the traceback.  Looking more closely, it appears that
the file in question is "/usr/bin/axis", line 3182 in the
_dynamic_tabs *function* (or method), which is called at the
module-level on line 3326 of the same file.  Edit /usr/bin/axis to
properly call Popen as mentioned in my previous email, and it should
solve this issue.

-tkc



-- 
https://mail.python.org/mailman/listinfo/python-list


Re: My first real request for help

2013-11-19 Thread xDog Walker
On Tuesday 2013 November 19 09:19, Gene Heskett wrote:
> _dynamic_tabs is not a file in /usr/lib/python2.6, nor does it "grep" in
> that directory.

The Traceback says that _dynamic_tabs is in /usr/bin/axis .

-- 
Yonder nor sorghum stenches shut ladle gulls stopper torque wet 
strainers.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Terry Jones: "Monty Python to reunite for stage show"

2013-11-19 Thread Chris “Kwpolska” Warrick
On Tue, Nov 19, 2013 at 3:08 PM, Thomas Heller  wrote:
> "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
> --
> https://mail.python.org/mailman/listinfo/python-list

The PSF should buy all the tickets and give them out to Python devs.
Or even invite the group to PyCon 2014.

-- 
Chris “Kwpolska” Warrick 
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: My first real request for help

2013-11-19 Thread Peter Otten
Gene Heskett wrote:

> 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 
>> >   
>> > _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 "", line 1, in 
>>   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"])
>> 
>> 
>> 
>> >>> alpha
>> 
>> beta
>> gamma
>> 
>> And this works, too (but is a bit less robust):
>> 
>> subprocess.Popen("ls -1", shell=True)
>> 
>> 
>> >>> alpha
>> 
>> beta
>> gamma
> 
> You are suggesting I edit /usr/lib/python2.6/subprocess.py?

No, first and foremost I suggested that you find out the actual value of 
cmd.

Only if that's indeed

(a) a string and
(b) contains a command with options

my demo shows two possible fixes that you can apply to the Popen() call in 
the _dynamic_tabs() function:

(1) The clean one: Make sure that cmd is a list with the executable as the 
first item and the options as the following items (this will require changes 
in other places), or

(2) The quick and dirty one: Leave everything as is and add shell=True to 
the Popen() call.


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: My first real request for help

2013-11-19 Thread Ethan Furman

On 11/19/2013 08:19 AM, Gene Heskett wrote:

On Tuesday 19 November 2013 11:16:10 Peter Otten did opine:

Gene Heskett wrote:


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)


You are suggesting I edit /usr/lib/python2.6/subprocess.py?


Yup.  Just make sure and change it back after you figure out what's going on.

--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list


Newbie - Trying to Help a Friend

2013-11-19 Thread bradleybooth12345
Hi,

A Friend is doing maths in University and has had some coursework to do with 
python.

The question is 

"Write a program that calculates how many positive integers less than N are not 
divisible by 2,3 or 5. The user should be prompted to supply the Number N. 
Demonstrate your program output when the input N is your student id. (13006517)

"The collatz process is as follows. Take a positive integer n greater than 1. 
while n is greater than 1 repeat the following; if N is even halve it and if N 
is odd multiply it by 3 and add 1. The (Unsolved) collatz conjecture is that 
this process always terminates.

The user should be prompted to supply the number n, and your program should 
build the list of values taken by sucessive iteration of the algorithm, and 
print it out. For example, if 7 is input your program should print the list 

[7,22,11,34,17,52,26,13,40,20,10,5,16,8,4,2,1]

Demonstrate your program output for an input value consisting of the number 
formed adding 10 to the last digit of your student id. (13006517)"

Any help would be appreciated
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: My first real request for help

2013-11-19 Thread Gene Heskett
On Tuesday 19 November 2013 12:42:28 Tim Chase did opine:

> On 2013-11-19 12:19, Gene Heskett wrote:
> > > On 2013-11-19 11:19, Gene Heskett wrote:
> > > >>> Traceback (most recent call last):
> > > >>>   File "/usr/bin/axis", line 3326, in 
> > > >>>   
> > > >>> _dynamic_tabs(inifile)
> > > >>>   
> > > >>>   File "/usr/bin/axis", line 3182, in _dynamic_tabs
> > > >>>   
> > > >>> child = Popen(cmd)
> > > > 
> > > > You are suggesting I edit /usr/lib/python2.6/subprocess.py?
> > > 
> > > I think Peter is suggesting that line 3182 in _dynamic_tabs should
> > > either read (the better way)
> > 
> > Now, this is a puzzle.
> > _dynamic_tabs is not a file in /usr/lib/python2.6, nor does it
> > "grep" in that directory.
> > 
> > I need another clue, how much are they? :).
> 
> Doh, I misread the traceback.  Looking more closely, it appears that
> the file in question is "/usr/bin/axis", line 3182 in the
> _dynamic_tabs *function* (or method), which is called at the
> module-level on line 3326 of the same file.  Edit /usr/bin/axis to
> properly call Popen as mentioned in my previous email, and it should
> solve this issue.
> 
> -tkc

Interesting, a print cmd immediately in front of that is quite noisy:
['./camview-emc-f1oat.py', '-v', '1280x720', '-C', 'camview.cfg', '-g', 
'cam.ui', '-H', 'campins.hal', '-w', '150995278']

So, I'll try this:
child = Popen(["cmd"]), but that's not the fix.  Thats 11 single 
quoted, csv separated strings in that "cmd", do I have to parse it and 
double quote & csv every one?

So, back to the last email:
Try child = Popen([cmd,args])

I killed the machine & had to go reboot it with the reset button.  I took 
the camera out and plugged it in, works great in camview or cheese.  Focus 
seem a bit distant at close to 2" but usable.

Then I took the line with the DEBUGGING statement back out, leaving just 
the print cmd above the

 child = Popen([cmd,args]), in line 3182, and now get this:

Traceback (most recent call last):
  File "/usr/bin/axis", line 3329, in 
_dynamic_tabs(inifile)
  File "/usr/bin/axis", line 3185, in _dynamic_tabs
child = Popen([cmd,args])
  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
AttributeError: 'list' object has no attribute 'rfind'

With the usual exit & cleanup.  Has this exposed another buglet?

Thanks Tim.

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)

"Never underestimate the power of a small tactical nuclear weapon."
A pen in the hand of this president is far more
dangerous than 200 million guns in the hands of
 law-abiding citizens.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: My first real request for help

2013-11-19 Thread Tim Chase
On 2013-11-19 13:43, Gene Heskett wrote:
> Interesting, a print cmd immediately in front of that is quite
> noisy: ['./camview-emc-f1oat.py', '-v', '1280x720', '-C',
> 'camview.cfg', '-g', 'cam.ui', '-H', 'campins.hal', '-w',
> '150995278']

This suggests that the value of "cmd" is indeed a list of
[program_name, arguments...] which is what it should be.  So the
Popen(cmd) should be right.

The next thing to verify that the working directory contains the
program that is being called, and that it's executable. So I'd add
some debugging dump, something like

  print(repr(cmd))
  ### added stuff below ###
  import os
  print("Current directory: %s" % os.getcwd())
  cmd_name = cmd[0]
  if os.path.isfile(cmd_name):
print("%s exists and has a mode of %o" % (
  cmd_name,
  os.stat(cmd_name).st_mode,
  ))
  else:
print("%s isn't a file (missing or a directory?)" % cmd_name)
  ### added stuff above ###
  child = Popen(cmd)

This should give you information on where the current working
directory is, whether the "./camview-emc-float.py" is in that
directory, and whether it is executable or not.

Just an observation here, it looks like you might have a "one"
instead of an "ell" in "float" in the file-name.  Intentional?

-tkc







-- 
https://mail.python.org/mailman/listinfo/python-list


Re: how to get raw bytes for ctypes functions that return c_wchar_p

2013-11-19 Thread Mark Summerfield
On Tuesday, November 19, 2013 5:22:36 PM UTC, Thomas Heller wrote:
> Am 19.11.2013 17:58, schrieb Mark Summerfield:
> 
> > Hi,
> 
> >
> 
> > I am using ctypes to access a function in a DLL using Python 3.3
> 
> > 32-bit on Windows 7 64-bit:
> 
> >
> 
> > dplGetPageText = dpl.DPLGetPageText dplGetPageText.argtypes =
> 
> > (ctypes.c_int, ctypes.c_int) dplGetPageText.restype =
> 
> > ctypes.c_wchar_p
> 
> >
> 
> > Python returns this as a str with the raw bytes already decoded.
> 
> >
> 
> > Unfortunately, when the returned text contains some special
> 
> > characters (e.g. © or fi) it is not encoded correctly. This may be a
> 
> > problem with Windows or with ctypes or with the library I'm using; or
> 
> > of course, it could be my own mistake.
> 
> >
> 
> > To find out, I'd like to change the restype to give me the raw bytes
> 
> > so that I can view them and if necessary decode them myself.
> 
> >
> 
> > Can anyone tell me how to change the restype to get the bytes?
> 
> 
> 
> ctypes on Python 2.7 has the set_conversion_mode(coding, errors)
> 
> which could be used to change the way c_wchar_p is converted
> 
> from/to Python strings.
> 
> Unfortunately it seems to be gone in Python 3.3.
> 
> 
> 
> However, you can set restype to POINTER(c_char) and then
> 
> index the result:
> 
> 
> 
> result = dplGetPageText(...)
> 
> print(result[0], result[1], result[2])
> 
> 
> 
> Thomas

That worked well. I also tried POINTER(c_wchar) which also worked (but in a 
different way). Now I can see the raw bytes and decode them how I like.

Thanks!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: My first real request for help

2013-11-19 Thread xDog Walker
On Tuesday 2013 November 19 10:43, Gene Heskett wrote:
> Interesting, a print cmd immediately in front of that is quite noisy:
> ['./camview-emc-f1oat.py', '-v', '1280x720', '-C', 'camview.cfg', '-g',
> 'cam.ui', '-H', 'campins.hal', '-w', '150995278']

The file it cannot find is apparently ./camview-emc.float.py

>So, I'll try this:
>child = Popen(["cmd"]), but that's not the fix.

That should produce the same result as before (plus gales of laughter from the 
bleachers).

-- 
Yonder nor sorghum stenches shut ladle gulls stopper torque wet 
strainers.



-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Newbie - Trying to Help a Friend

2013-11-19 Thread maxwell34m
On Tuesday, November 19, 2013 10:40:18 AM UTC-8, bradleyb...@gmail.com wrote:
> Hi,
> 
> 
> 
> A Friend is doing maths in University and has had some coursework to do with 
> python.
> 
> 
> 
> The question is 
> 
> 
> 
> "Write a program that calculates how many positive integers less than N are 
> not divisible by 2,3 or 5. The user should be prompted to supply the Number 
> N. Demonstrate your program output when the input N is your student id. 
> (13006517)
> 
> 
> 
> "The collatz process is as follows. Take a positive integer n greater than 1. 
> while n is greater than 1 repeat the following; if N is even halve it and if 
> N is odd multiply it by 3 and add 1. The (Unsolved) collatz conjecture is 
> that this process always terminates.
> 
> 
> 
> The user should be prompted to supply the number n, and your program should 
> build the list of values taken by sucessive iteration of the algorithm, and 
> print it out. For example, if 7 is input your program should print the list 
> 
> 
> 
> [7,22,11,34,17,52,26,13,40,20,10,5,16,8,4,2,1]
> 
> 
> 
> Demonstrate your program output for an input value consisting of the number 
> formed adding 10 to the last digit of your student id. (13006517)"
> 
> 
> 
> Any help would be appreciated

I'm pretty sure this is not a group for helping people  cheat on their school 
coursework.

You,the one trying to supposedly help him couldn't even write a single line of 
code. How is that "helping"?

Kindly come back when u've done some real work and you are stuck.

I hope I've been of "help" to you and your friend.

thanks
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Newbie - Trying to Help a Friend

2013-11-19 Thread Neil Cerutti
bradleybooth12...@gmail.com via python.org asks:
> A Friend is doing maths in University and has had some
> coursework to do with python.
>
> The question is
>
> "Write a program that calculates how many positive integers
> less than N are not divisible by 2,3 or 5. The user should be
> prompted to supply the Number N. Demonstrate your program
> output when the input N is your student id. (13006517)
>
> "The collatz process is as follows. Take a positive integer n
> greater than 1. while n is greater than 1 repeat the following;
> if N is even halve it and if N is odd multiply it by 3 and add
> 1. The (Unsolved) collatz conjecture is that this process
> always terminates.
>
> The user should be prompted to supply the number n, and your
> program should build the list of values taken by sucessive
> iteration of the algorithm, and print it out. For example, if 7
> is input your program should print the list
>
> [7,22,11,34,17,52,26,13,40,20,10,5,16,8,4,2,1]
>
> Demonstrate your program output for an input value consisting
> of the number formed adding 10 to the last digit of your
> student id. (13006517)"
>
> Any help would be appreciated

What has A Friend written so far? Where are you stuck?

-- 
Neil Cerutti

On Tue, Nov 19, 2013 at 1:40 PM,   wrote:
> Hi,
>
> A Friend is doing maths in University and has had some coursework to do with 
> python.
>
> The question is
>
> "Write a program that calculates how many positive integers less than N are 
> not divisible by 2,3 or 5. The user should be prompted to supply the Number 
> N. Demonstrate your program output when the input N is your student id. 
> (13006517)
>
> "The collatz process is as follows. Take a positive integer n greater than 1. 
> while n is greater than 1 repeat the following; if N is even halve it and if 
> N is odd multiply it by 3 and add 1. The (Unsolved) collatz conjecture is 
> that this process always terminates.
>
> The user should be prompted to supply the number n, and your program should 
> build the list of values taken by sucessive iteration of the algorithm, and 
> print it out. For example, if 7 is input your program should print the list
>
> [7,22,11,34,17,52,26,13,40,20,10,5,16,8,4,2,1]
>
> Demonstrate your program output for an input value consisting of the number 
> formed adding 10 to the last digit of your student id. (13006517)"
>
> Any help would be appreciated
> --
> https://mail.python.org/mailman/listinfo/python-list



-- 
Neil Cerutti 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: My first real request for help

2013-11-19 Thread xDog Walker
On Tuesday 2013 November 19 10:57, Tim Chase wrote:
> Just an observation here, it looks like you might have a "one"
> instead of an "ell" in "float" in the file-name.

That is exactly what I see using Monospace font where the letter and digit are 
different shapes.
-- 
Yonder nor sorghum stenches shut ladle gulls stopper torque wet 
strainers.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Newbie - Trying to Help a Friend

2013-11-19 Thread Gary Herron

On 11/19/2013 10:40 AM, bradleybooth12...@gmail.com wrote:

Hi,

A Friend is doing maths in University and has had some coursework to do with 
python.

The question is

"Write a program that calculates how many positive integers less than N are not 
divisible by 2,3 or 5. The user should be prompted to supply the Number N. 
Demonstrate your program output when the input N is your student id. (13006517)

"The collatz process is as follows. Take a positive integer n greater than 1. 
while n is greater than 1 repeat the following; if N is even halve it and if N is 
odd multiply it by 3 and add 1. The (Unsolved) collatz conjecture is that this 
process always terminates.

The user should be prompted to supply the number n, and your program should 
build the list of values taken by sucessive iteration of the algorithm, and 
print it out. For example, if 7 is input your program should print the list

[7,22,11,34,17,52,26,13,40,20,10,5,16,8,4,2,1]

Demonstrate your program output for an input value consisting of the number formed 
adding 10 to the last digit of your student id. (13006517)"

Any help would be appreciated


What sort of help are you requesting?  We're not in the habit of writing 
student assignments for them because they will learn nothing from such 
an effort.
Your friend should read the book/lecture-notes/whatever, and make an 
attempt on the assignment.  If he gets stuck, he may ask a specific 
Python question.  I'm sure lots of help will follow.


As a side note, these are extremely simple beginner problems, each 
requiring only a few lines of code.  Any programming class that assigned 
these must have included some lectures on the basics of programming.   
That's where he should start.


Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list


Re: My first real request for help

2013-11-19 Thread Mark Lawrence

On 19/11/2013 19:06, xDog Walker wrote:

On Tuesday 2013 November 19 10:43, Gene Heskett wrote:

Interesting, a print cmd immediately in front of that is quite noisy:
['./camview-emc-f1oat.py', '-v', '1280x720', '-C', 'camview.cfg', '-g',
'cam.ui', '-H', 'campins.hal', '-w', '150995278']


The file it cannot find is apparently ./camview-emc.float.py


So, I'll try this:
child = Popen(["cmd"]), but that's not the fix.


That should produce the same result as before (plus gales of laughter from the
bleachers).



Just to be sure is it a simple typo "f1oat" with a one instead of 
"float" with an ell?


--
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list


Re: My first real request for help

2013-11-19 Thread xDog Walker
On Tuesday 2013 November 19 10:57, Tim Chase wrote:
> Just an observation here, it looks like you might have a "one"
> instead of an "ell" in "float" in the file-name.

Gene, 
In an earlier email in this thread I lied when I stated the name of the
file you were missing (I retyped what I thought I saw rather than
copy+pasting).

Tim Chase caught what is most likely your immediate problem: a digit
one rather the letter ell in the filename. Where that filename came
from is where you should be looking, imho.

-- 
Yonder nor sorghum stenches shut ladle gulls stopper torque wet 
strainers.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Newbie - Trying to Help a Friend

2013-11-19 Thread bradleybooth12345
On Tuesday, November 19, 2013 6:40:18 PM UTC, bradleyb...@gmail.com wrote:
> Hi,
> 
> 
> 
> A Friend is doing maths in University and has had some coursework to do with 
> python.
> 
> 
> 
> The question is 
> 
> 
> 
> "Write a program that calculates how many positive integers less than N are 
> not divisible by 2,3 or 5. The user should be prompted to supply the Number 
> N. Demonstrate your program output when the input N is your student id. 
> (13006517)
> 
> 
> 
> "The collatz process is as follows. Take a positive integer n greater than 1. 
> while n is greater than 1 repeat the following; if N is even halve it and if 
> N is odd multiply it by 3 and add 1. The (Unsolved) collatz conjecture is 
> that this process always terminates.
> 
> 
> 
> The user should be prompted to supply the number n, and your program should 
> build the list of values taken by sucessive iteration of the algorithm, and 
> print it out. For example, if 7 is input your program should print the list 
> 
> 
> 
> [7,22,11,34,17,52,26,13,40,20,10,5,16,8,4,2,1]
> 
> 
> 
> Demonstrate your program output for an input value consisting of the number 
> formed adding 10 to the last digit of your student id. (13006517)"
> 
> 
> 
> Any help would be appreciated

Think they just needed a starting point really to be honest as they can't get 
there head round it.

That was all. Badly worded this, wasn't looking for someone to do it all for 
him apologies
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Newbie - Trying to Help a Friend

2013-11-19 Thread Denis McMahon
On Tue, 19 Nov 2013 11:27:08 -0800, bradleybooth12345 wrote:

> On Tuesday, November 19, 2013 6:40:18 PM UTC, bradleyb...@gmail.com
> wrote:

>> "Write a program that calculates how many positive integers less than N
>> are not divisible by 2,3 or 5.

>> "The collatz process .

>> Any help would be appreciated

> Think they just needed a starting point really to be honest as they
> can't get there head round it.

First of all there seems to be two problems, not 1.

Here are some steps for each of the calculations. Any resemblance of 
these steps to actual program code is due to my not bothering to 
obfuscate the statement and function names more than I did.

1) Find all the numbers less than n that are not divisible by a, b, or c.

ask the user for x;
assign the value 0 to some other variable i;
while i is not greater than than x do the following [
if i is not divisible by a and i is not divisible by b and i is not 
divisible by c then display i to the user;
add 1 to i;
]

2) Find the collatz sequence for x.

ask the user for initial x;
while x is not 1 {
if x is divisible by 2 [ new x = perform even number collatz math on x; ]
otherwise [ new x = perform odd number collatz math on x; ]
display new x to the user;
}

-- 
Denis McMahon, denismfmcma...@gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Several Topics - Nov. 19, 2013

2013-11-19 Thread glen herrmannsfeldt
In comp.lang.fortran E.D.G.  wrote:
>>> "E.D.G."  wrote in message 
>>> news:ro-dnch2dptbrhnpnz2dnuvz_rsdn...@earthlink.com...
> Posted by E.D.G. on November 19, 2013
 
> 1.  PERL PDL CALCULATION SPEED VERSUS PYTHON AND FORTRAN
 
(snip)

>   This program translation project has become one of the most 
> surprisingly successful programming projects I have worked on to date.  A 
> considerable amount of valuable information has been sent to me by E-mail in 
> addition to all of the information posted to the Newsgroups.
 
>   The original posts actually discussed calculation speed matters 
> involving Perl and Python.  And responses indicated that there were ways to 
> develop routines that could dramatically accelerate Python calculations. 
> But it did not sound like there were any for Perl.

In general, language processors can be divided into two categories
called compilers and interpreters.  Compilers generate instructions for
the target processors. Interpreters generate (usually) an intermediate
representation which is then interpreted by a program to perform the
desired operations. That latter tends to be much slower, but more
portable.

There are a few langauges that allow dynamic generation of code, which
often makes compilation impossible, and those languages tend to be
called 'interpreted langauges'. 

Some years ago when working with perl programs that ran too slow, we
found a perl to C translator. Surprisingly, the result ran just as slow!
It turns out that the perl to C translator generates a C program
containing the intermediate code and the interpreter, and so runs just
the same speed.

More recently, there are JIT systems which generate the intermediate
code, but then at the appropriate time (Just In Time) compile that to
machine code and execute it. This is common for Java, and more recently
for languages like Matlab.

-- glen
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Several Topics - Nov. 19, 2013

2013-11-19 Thread Yaşar Arabacı
2013/11/19 glen herrmannsfeldt :
> More recently, there are JIT systems which generate the intermediate
> code, but then at the appropriate time (Just In Time) compile that to
> machine code and execute it. This is common for Java, and more recently
> for languages like Matlab.

Is there a particular reason why you didn't mention PyPy?

-- 
http://ysar.net/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Several Topics - Nov. 19, 2013

2013-11-19 Thread Rainer Weikusat
glen herrmannsfeldt  writes:
> In comp.lang.fortran E.D.G.  wrote:
 "E.D.G."  wrote in message 
 news:ro-dnch2dptbrhnpnz2dnuvz_rsdn...@earthlink.com...
>> Posted by E.D.G. on November 19, 2013
>  
>> 1.  PERL PDL CALCULATION SPEED VERSUS PYTHON AND FORTRAN
>  
> (snip)
>
>>   This program translation project has become one of the most 
>> surprisingly successful programming projects I have worked on to date.  A 
>> considerable amount of valuable information has been sent to me by E-mail in 
>> addition to all of the information posted to the Newsgroups.
>  
>>   The original posts actually discussed calculation speed matters 
>> involving Perl and Python.  And responses indicated that there were ways to 
>> develop routines that could dramatically accelerate Python calculations. 
>> But it did not sound like there were any for Perl.
>
> In general, language processors can be divided into two categories
> called compilers and interpreters.  Compilers generate instructions for
> the target processors. Interpreters generate (usually) an intermediate
> representation which is then interpreted by a program to perform the
> desired operations. That latter tends to be much slower, but more
> portable.
>
> There are a few langauges that allow dynamic generation of code, which
> often makes compilation impossible, and those languages tend to be
> called 'interpreted langauges'.

These two paragraphs use the same terms in conflicting ways and the
assertions in the second paragraph are wrong: Lisp is presumably the
oldest language which allows 'dynamic code creation' and implementations
exist which not only have a compiler but actually don't have an
interpreter, cf

http://www.sbcl.org/manual/index.html#Compiler_002donly-Implementation

The main difference between a compiler and an interpreter is that the
compiler performs lexical and semantical analysis of 'the source code'
once and then transforms it into some kind of different 'directly
executable representation' while an interpreter would analyze some part
of the source code, execute it, analyze the next, execute that, and so
forth, possibly performing lexical and semantical analysis steps many
times for the same bit of 'source code'.

Some compilers produce 'machine code' which can be executed directly by
'a CPU', others generate 'machine code' for some kind of virtual machine
which is itself implemented as a program. The distinction isn't really
clear-cut because some CPUs are designed to run 'machine code'
originally targetted at a virtual machine, eg, what used to be ARM
Jazelle for executing JVM byte code directly on an ARM CPU, some virtual
machines are supposed to execute 'machine code' which used to run
'directly on a CPU' in former times, eg, used for backwards
compatibility on Bull Novascale computers.

Prior to execution, Perl source code is compiled to 'machine code' for a
(stack-based) virtual machine. Both the compiler and the VM are provided
by the perl program. There were some attempts to create a standalone
Perl compiler in the past but these never gained much traction.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: My first real request for help

2013-11-19 Thread Gene Heskett
On Tuesday 19 November 2013 16:03:23 Tim Chase did opine:

> On 2013-11-19 13:43, Gene Heskett wrote:
> > Interesting, a print cmd immediately in front of that is quite
> > noisy: ['./camview-emc-f1oat.py', '-v', '1280x720', '-C',
> > 'camview.cfg', '-g', 'cam.ui', '-H', 'campins.hal', '-w',
> > '150995278']
> 
> This suggests that the value of "cmd" is indeed a list of
> [program_name, arguments...] which is what it should be.  So the
> Popen(cmd) should be right.
> 
> The next thing to verify that the working directory contains the
> program that is being called, and that it's executable. So I'd add
> some debugging dump, something like
> 
>   print(repr(cmd))
>   ### added stuff below ###
>   import os
>   print("Current directory: %s" % os.getcwd())
>   cmd_name = cmd[0]
>   if os.path.isfile(cmd_name):
> print("%s exists and has a mode of %o" % (
>   cmd_name,
>   os.stat(cmd_name).st_mode,
>   ))
>   else:
> print("%s isn't a file (missing or a directory?)" % cmd_name)
>   ### added stuff above ###
>   child = Popen(cmd)
> 
> This should give you information on where the current working
> directory is, whether the "./camview-emc-float.py" is in that
> directory, and whether it is executable or not.
> 
> Just an observation here, it looks like you might have a "one"
> instead of an "ell" in "float" in the file-name.  Intentional?
> 
> -tkc

That is a possibility, I know I had some file not found errors that were 
only fixed by do an mv (copy/paste for ls listing camview-emc-float.py, in 
which case the miss-spelling is how its name on the web page I pulled it 
from.

Adding , shell=True to the Popen fixed it so it runs, but with unusual 
results.  It is SUPPOSED to make tab controlled overlay over the linuxcnc 
backplot window when that tab is selected.  The tab is there, but the 
window is blank because its opening a new window.  And the final halio 
stanza of the config isn't running, I presume because its also reporting:

** (camview-emc-float.py:3775): WARNING **: 
/usr/local/lib/camunits/halio.so: undefined symbol: gluOrtho2D

on the linuxcnc launch.

I do not have libgl installed because then the other camera didn't work, 
but am using the mesa-swx11 version so it would work.  So what I'll 
probably have to do is install libgl long enough to rebuild halio.so and 
install it.  I think its named wrong, it should be Duncan, like the yo-yo 
maker. :)

So I guess thats next, re-install libgl & -dev, rebuild halio.so, (no error 
yip about a missing GL/gl.h now, and then see if it works with this camera.  
But I have a bet with myself that it will look like its out of horizontal 
synch.  Actually it was a black screen, reinstall the lib gl-mesa-swx11 
stuff, the camera works again it its own window, and I still see the above 
undefined gluOrtho2D error.

Thanks a bunch Tim, but I think I'll see if the halio.c author can speak to 
this one.

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)

You're too beautiful to ignore.  Too much woman.
-- Kirk to Yeoman Rand, "The Enemy Within", stardate 
unknown
A pen in the hand of this president is far more
dangerous than 200 million guns in the hands of
 law-abiding citizens.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: My first real request for help

2013-11-19 Thread Gene Heskett
On Tuesday 19 November 2013 17:02:37 Mark Lawrence did opine:

> On 19/11/2013 19:06, xDog Walker wrote:
> > On Tuesday 2013 November 19 10:43, Gene Heskett wrote:
> >> Interesting, a print cmd immediately in front of that is quite noisy:
> >> ['./camview-emc-f1oat.py', '-v', '1280x720', '-C', 'camview.cfg',
> >> '-g', 'cam.ui', '-H', 'campins.hal', '-w', '150995278']
> > 
> > The file it cannot find is apparently ./camview-emc.float.py
> > 
> >> So, I'll try this:
> >> child = Popen(["cmd"]), but that's not the fix.
> > 
> > That should produce the same result as before (plus gales of laughter
> > from the bleachers).
>
Expected. Python code isn't my forte obviously. :)
  
> Just to be sure is it a simple typo "f1oat" with a one instead of
> "float" with an ell?

That it was, now renamed.  And now that I know it works albeit in a 
separate window, I will now go back to the original syntax just to check, 
but no, the additional ", shell=True" without the double-quotes, inside the 
parens is still needed.

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 never met a man I didn't want to fight.
-- Lyle Alzado, professional football lineman
A pen in the hand of this president is far more
dangerous than 200 million guns in the hands of
 law-abiding citizens.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: My first real request for help

2013-11-19 Thread Gene Heskett
On Tuesday 19 November 2013 17:17:12 xDog Walker did opine:

> On Tuesday 2013 November 19 10:57, Tim Chase wrote:
> > Just an observation here, it looks like you might have a "one"
> > instead of an "ell" in "float" in the file-name.
> 
> Gene,
> In an earlier email in this thread I lied when I stated the name of
> the file you were missing (I retyped what I thought I saw rather than
> copy+pasting).
> 
> Tim Chase caught what is most likely your immediate problem: a digit
> one rather the letter ell in the filename. Where that filename came
> from is where you should be looking, imho.

That will be called to the attention of the wiki submitter.  I doubt if its 
that important as long as its consistent though.  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)

I am a bookaholic.  If you are a decent person, you will not sell me
another book.
A pen in the hand of this president is far more
dangerous than 200 million guns in the hands of
 law-abiding citizens.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Several Topics - Nov. 19, 2013

2013-11-19 Thread glen herrmannsfeldt
In comp.lang.fortran Rainer Weikusat  wrote:
> glen herrmannsfeldt  writes:
>> In comp.lang.fortran E.D.G.  wrote:
> "E.D.G."  wrote in message 
> news:ro-dnch2dptbrhnpnz2dnuvz_rsdn...@earthlink.com...
>>> Posted by E.D.G. on November 19, 2013
  
>>> 1.  PERL PDL CALCULATION SPEED VERSUS PYTHON AND FORTRAN
  
 (snip)

>>>   This program translation project has become one of the most 
>>> surprisingly successful programming projects I have worked on to date.  A 
>>> considerable amount of valuable information has been sent to me by E-mail 
>>> in 
>>> addition to all of the information posted to the Newsgroups.

(snip, I wrote)

>> In general, language processors can be divided into two categories
>> called compilers and interpreters.  Compilers generate instructions for
>> the target processors. Interpreters generate (usually) an intermediate
>> representation which is then interpreted by a program to perform the
>> desired operations. That latter tends to be much slower, but more
>> portable.

>> There are a few langauges that allow dynamic generation of code, which
>> often makes compilation impossible, and those languages tend to be
>> called 'interpreted langauges'.
 
> These two paragraphs use the same terms in conflicting ways and the
> assertions in the second paragraph are wrong: Lisp is presumably the
> oldest language which allows 'dynamic code creation' and implementations
> exist which not only have a compiler but actually don't have an
> interpreter, cf
 
> http://www.sbcl.org/manual/index.html#Compiler_002donly-Implementation
 
> The main difference between a compiler and an interpreter is that the
> compiler performs lexical and semantical analysis of 'the source code'
> once and then transforms it into some kind of different 'directly
> executable representation' while an interpreter would analyze some part
> of the source code, execute it, analyze the next, execute that, and so
> forth, possibly performing lexical and semantical analysis steps many
> times for the same bit of 'source code'.

OK, but many intepreters at least do a syntax check on the whole file,
and many also convert the statements to a more convenient internal
representation.

For an example of something that can't be compiled, consider TeX which
allows the category code of characters to be changed dynamically.

I once wrote self-modifying code for Mathematica, where the running code
(on what Mathematica calls the back end) asked the front end (which does
editing of input data) to change the code. 
 
> Some compilers produce 'machine code' which can be executed directly by
> 'a CPU', others generate 'machine code' for some kind of virtual machine
> which is itself implemented as a program. The distinction isn't really
> clear-cut because some CPUs are designed to run 'machine code'
> originally targetted at a virtual machine, eg, what used to be ARM
> Jazelle for executing JVM byte code directly on an ARM CPU, some virtual
> machines are supposed to execute 'machine code' which used to run
> 'directly on a CPU' in former times, eg, used for backwards
> compatibility on Bull Novascale computers.

Yes. There are also systems that do simple processing on each statement,
with no interstatement memory. Converting numerical constants to
internal form, encoding keywords to a single byte, and such. 

It is interesting to see the program listing look different than the way
it was entered, such as constants coming out as 1e6 when you entered
it as 100.  The HP2000 BASIC system is the one I still remember.

The popular microcomputer BASIC systems, mostly from Microsoft, allowed
things like:

IF I=1 THEN FOR J=1 TO 10
PRINT J
IF I=1 THEN NEXT J

If you left out the IF on the last line, it would fail when it reached
the NEXT J statement if the FOR hadn't been executed. Compare to C:

if(i==1) for(j=1;j<=10;j++) {
   printf("%d\n",j);
}

A compiler would match up the FOR and NEXT at compile time. Many 
interpreters do it at run time, depending on the current state.

I also used to use a BASIC system that allowed you to stop a program
(or the program stopped itself), change statements (fix bugs) and
continue on from where it stopped. Not all can do that, but pretty
much compilers never do.
 
> Prior to execution, Perl source code is compiled to 'machine code' for a
> (stack-based) virtual machine. Both the compiler and the VM are provided
> by the perl program. There were some attempts to create a standalone
> Perl compiler in the past but these never gained much traction.

And, importantly, the code runs fairly slow. Some years ago, I was
working with simple PERL programs that could process data at 1 megabyte
per minute. Rewriting in C, I got one megabyte per second. It is not too
unusual to run 10 times slower, but 60 was rediculous.

-- glen
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: My first real request for help

2013-11-19 Thread Gene Heskett
On Tuesday 19 November 2013 16:48:40 xDog Walker did opine:

> On Tuesday 2013 November 19 10:57, Tim Chase wrote:
> > Just an observation here, it looks like you might have a "one"
> > instead of an "ell" in "float" in the file-name.
> 
> That is exactly what I see using Monospace font where the letter and
> digit are different shapes.

And I see exactly that in firefox. That l is indeed a 1.  No wonder I 
couldn't type it, but could copy/paste it.  Until I renamed it with an l.

That bit of confusion first bit me hard, darned near 30 tears ago, building 
a trig functions library for the Microware C compiler running on a trs-80 
Color Computer. Source published in the Rainbow magazine, Offset plates 
made from a DMP printer.  I don't remember that fondly at all. I traded 
printers because of that, the 9 pin DMP's used exactly the same image for 
both.  I had quite a bit more gray hair when that was done. :(

Thanks for making me go look again. :)

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)

"Ninety percent of baseball is half mental."
-- Yogi Berra
A pen in the hand of this president is far more
dangerous than 200 million guns in the hands of
 law-abiding citizens.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: My first real request for help

2013-11-19 Thread Gene Heskett
On Tuesday 19 November 2013 17:20:54 Ethan Furman did opine:

> On 11/19/2013 08:19 AM, Gene Heskett wrote:
> > On Tuesday 19 November 2013 11:16:10 Peter Otten did opine:
> >> Gene Heskett wrote:
> >>> 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)
> > 
> > You are suggesting I edit /usr/lib/python2.6/subprocess.py?
> 
> Yup.  Just make sure and change it back after you figure out what's
> going on.
> 
> --
> ~Ethan~

Tried, no deal, took it back to the -bak copy.

Where I need the Popen patch was actually in /usr/bin/axis, which is the 
name of the programs gui I run.  There are several available.

Many 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)

 Joy: Hey, I'm an asshole.  Assholes emit odious gas.
That's what we do.
A pen in the hand of this president is far more
dangerous than 200 million guns in the hands of
 law-abiding citizens.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Newbie - Trying to Help a Friend

2013-11-19 Thread Mark Janssen
> Think they just needed a starting point really to be honest as they can't get 
> there head round it.

Then the problem is that your friend doesn't understand one or more of
the words being used.  This is s necessary prerequisite for making an
algorithm from a text description.  Perhaps they don't know what it
means to be "divisible".

-- 
MarkJ
Tacoma, Washington
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Several Topics - Nov. 19, 2013

2013-11-19 Thread Chris Angelico
On Wed, Nov 20, 2013 at 9:43 AM, glen herrmannsfeldt
 wrote:
> I also used to use a BASIC system that allowed you to stop a program
> (or the program stopped itself), change statements (fix bugs) and
> continue on from where it stopped. Not all can do that, but pretty
> much compilers never do.

Ditto, both in GW-BASIC and Q-BASIC, but in each case there were some
fairly strict rules about what could be edited. Changing anything to
do with control flow quickly got you a "Can't continue" error. And of
course, assembly language with DEBUG.EXE lets you do basically
anything... rewrite memory (code or data, there's no difference),
change the instruction pointer (so execution resumes somewhere else),
change other registers, etc, etc.

Most languages don't give you quite that much flexibility, because
it's really REALLY easy to mess things up and confuse yourself
completely. Python kinda will, though; all you have to do is fiddle
with sys.modules so it won't be cached, or rename the file to
something unique before reimporting it. You can then patch in
functions from the new module and start using them. Pike makes this
sort of thing much more convenient; it's not hard to write code that
smoothly slides to a new version of itself, without losing any sort of
state. But the granularity never gets down below the function, meaning
the Python and Pike compilers/interpreters are free to fiddle around
inside a function (note, for instance, how Python locals basically
just become indices into an array; it'd be a bit awkward to tweak a
running Python function and add a 'global' declaration).

ChrisA
(See? I'm posting on topic!)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Newbie - Trying to Help a Friend

2013-11-19 Thread Steven D'Aprano
On Tue, 19 Nov 2013 10:40:18 -0800, bradleybooth12345 wrote:

> Hi,
> 
> A Friend is doing maths in University and has had some coursework to do
> with python.
> 
> The question is
> 
> "Write a program that calculates how many positive integers less than N
> are not divisible by 2,3 or 5. The user should be prompted to supply the
> Number N. Demonstrate your program output when the input N is your
> student id. (13006517)


Have your friend start by writing down how she or he would solve this 
problem by hand. I'll get you started by solving the problem for 7.

Positive integers less than 23 are 1, 2, 3, 4, 5, 6. So let's start 
checking them for divisors:

- 1 is not divisible by 2, 3 or 5, so we count one number.
- 2 is divisible by 2, but not by 3 or 5, so we count two numbers.
- 3 is not divisible by 2, so we count three numbers.
- 4 is divisible by 2, but not 3 or 5, so we count four numbers
- 5 is not divisible by 2, so we count five numbers.
- 6 is divisible by 2 and 3, but not by 5, so we count six numbers.

And the answer is: 6.

Now that you know what you yourself would do to solve this problem, the 
next step is to write it in terms that a computer can understand. A few 
hints:

1) You can check divisibility by using the % operator, which returns the 
remainder after division. So 36 % 6 gives 0, which means that 36 is 
divisible by 6. 37 % 6 gives 1, which means 37 is not divisible by 6.

2) You can use "for i in range(1, N)" to generate the positive integers 
less than N.

3) You can use the "or" operator to efficiently check multiple 
conditions. For example, this line of code:

if (a % 2) or (a > 16):

checks whether a number a is either an odd number or larger than sixteen, 
and if so runs the indented block of code following (not shown).

4) You can prompt the user for a value using the input (Python 3) or 
raw_input (Python 2) function. For example, using Python 2:

result = raw_input("Enter a number between 3 and 12: ")

lets the user type in anything in response. That result will be a string, 
to convert it to a number:

result = int(result)

5) You can create a variable and initialise it to some value like this:

count = 0

creates a variable called "count", set to the value 0. You can then add 
one to it like this:

count = count + 1

or if you prefer:

count += 1

Either way adds one to count.

I expect that the above should be enough to get your friend started and 
possibly even finished. If she/he gets stuck, come back with some code 
and specific questions.

Good luck!



-- 
Steven
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Using try-catch to handle multiple possible file types?

2013-11-19 Thread Victor Hooi
Hi,

Is either approach (try-excepts, or using libmagic) considered more idiomatic? 
What would you guys prefer yourselves?

Also, is it possible to use either approach with a context manager ("with"), 
without duplicating lots of code?

For example:

try:
with gzip.open('blah.txt', 'rb') as f:
for line in f:
print(line)
except IOError as e:
with open('blah.txt', 'rb') as f:
for line in f:
print(line)

I'm not sure of how to do this without needing to duplicating the processing 
lines (everything inside the with)?

And using:

try:
f = gzip.open('blah.txt', 'rb')
except IOError as e:
f = open('blah.txt', 'rb')
finally:
for line in f:
print(line)

won't work, since the exception won't get thrown until you actually try to open 
the file. Plus, I'm under the impression that I should be using 
context-managers where I can.

Also, on another note, python-magic will return a string as a result, e.g.:

gzip compressed data, was "blah.txt", from Unix, last modified: Wed Nov 20 
10:48:35 2013

I suppose it's enough to just do a?

if "gzip compressed data" in results:

or is there a better way?

Cheers,
Victor

On Tuesday, 19 November 2013 20:36:47 UTC+11, Mark Lawrence  wrote:
> On 19/11/2013 07:13, Victor Hooi wrote:
> 
> >
> 
> > So basically, using exception handling for flow-control.
> 
> >
> 
> > However, is that considered bad practice, or un-Pythonic?
> 
> >
> 
> 
> 
> If it works for you use it, practicality beats purity :)
> 
> 
> 
> -- 
> 
> Python is the second best programming language in the world.
> 
> But the best has yet to be invented.  Christian Tismer
> 
> 
> 
> Mark Lawrence
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python classes for reading/writing/parsing MIDI files

2013-11-19 Thread alex23

On 20/11/2013 12:12 AM, Chris Angelico wrote:

On Wed, Nov 20, 2013 at 12:50 AM, Annmarina Nagy  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.


They appear to be resurrecting a 12 year old thread.

--
https://mail.python.org/mailman/listinfo/python-list


Re: Using try-catch to handle multiple possible file types?

2013-11-19 Thread Steven D'Aprano
On Tue, 19 Nov 2013 16:30:46 -0800, Victor Hooi wrote:

> Hi,
> 
> Is either approach (try-excepts, or using libmagic) considered more
> idiomatic? What would you guys prefer yourselves?

Specifically in the case of file types, I consider it better to use 
libmagic. But as a general technique, using try...except is a reasonable 
approach in many situations.


> Also, is it possible to use either approach with a context manager
> ("with"), without duplicating lots of code?
> 
> For example:
> 
> try:
>   with gzip.open('blah.txt', 'rb') as f:
>   for line in f:
>   print(line)
> except IOError as e:
>   with open('blah.txt', 'rb') as f:
>   for line in f:
>   print(line)
> 
> I'm not sure of how to do this without needing to duplicating the
> processing lines (everything inside the with)?

Write a helper function:

def process(opener):
with opener('blah.txt', 'rb') as f:
for line in f:
print(line)


try:
process(gzip.open)
except IOError:
process(open)


If you have many different things to try:


for opener in [gzip.open, open, ...]:
try:
process(opener)
except IOError:
continue
else:
break



[...]
> Also, on another note, python-magic will return a string as a result,
> e.g.:
> 
> gzip compressed data, was "blah.txt", from Unix, last modified: Wed Nov
> 20 10:48:35 2013
> 
> I suppose it's enough to just do a?
> 
> if "gzip compressed data" in results:
> 
> or is there a better way?

*shrug*

Read the docs of python-magic. Do they offer a programmable API? If not, 
that kinda sucks.



-- 
Steven
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python classes for reading/writing/parsing MIDI files

2013-11-19 Thread Steven D'Aprano
On Wed, 20 Nov 2013 10:32:08 +1000, alex23 wrote:

> On 20/11/2013 12:12 AM, Chris Angelico wrote:
>> On Wed, Nov 20, 2013 at 12:50 AM, Annmarina Nagy 
>> 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.
> 
> They appear to be resurrecting a 12 year old thread.

Wow, that's one slow News server.


-- 
Steven
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Using try-catch to handle multiple possible file types?

2013-11-19 Thread Mark Lawrence

On 20/11/2013 00:30, Victor Hooi wrote:

Hi,

Is either approach (try-excepts, or using libmagic) considered more idiomatic? 
What would you guys prefer yourselves?

Also, is it possible to use either approach with a context manager ("with"), 
without duplicating lots of code?

For example:

try:
with gzip.open('blah.txt', 'rb') as f:
for line in f:
print(line)
except IOError as e:
with open('blah.txt', 'rb') as f:
for line in f:
print(line)

I'm not sure of how to do this without needing to duplicating the processing 
lines (everything inside the with)?

And using:

try:
f = gzip.open('blah.txt', 'rb')
except IOError as e:
f = open('blah.txt', 'rb')
finally:
for line in f:
print(line)

won't work, since the exception won't get thrown until you actually try to open 
the file. Plus, I'm under the impression that I should be using 
context-managers where I can.

Also, on another note, python-magic will return a string as a result, e.g.:

gzip compressed data, was "blah.txt", from Unix, last modified: Wed Nov 20 
10:48:35 2013

I suppose it's enough to just do a?

 if "gzip compressed data" in results:

or is there a better way?

Cheers,
Victor

On Tuesday, 19 November 2013 20:36:47 UTC+11, Mark Lawrence  wrote:

On 19/11/2013 07:13, Victor Hooi wrote:






So basically, using exception handling for flow-control.







However, is that considered bad practice, or un-Pythonic?








If it works for you use it, practicality beats purity :)



--

Python is the second best programming language in the world.

But the best has yet to be invented.  Christian Tismer



Mark Lawrence


Something like

for filetype in filetypes:
  try:
process(filetype)
break
  except IOError:
pass

??? as it's 01:50 GMT and I can't sleep :(

--
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list


Re: Python classes for reading/writing/parsing MIDI files

2013-11-19 Thread David
On 20 November 2013 12:57, Steven D'Aprano
 wrote:
> On Wed, 20 Nov 2013 10:32:08 +1000, alex23 wrote:
>>
>> They appear to be resurrecting a 12 year old thread.
>
> Wow, that's one slow News server.

http://en.wikipedia.org/wiki/Slow_Movement

:)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Newbie - Trying to Help a Friend

2013-11-19 Thread Dave Angel
On 20 Nov 2013 00:17:23 GMT, Steven D'Aprano 
 wrote:

problem by hand. I'll get you started by solving the problem for 7.





Positive integers less than 23 are 1, 2, 3, 4, 5, 6. So let's start 
checking them for divisors:


Where did 23 come from?



- 1 is not divisible by 2, 3 or 5, so we count one number.
- 2 is divisible by 2, but not by 3 or 5, so we count two numbers.


2 doesn't count because it's divisible by 2. 


- 3 is not divisible by 2, so we count three numbers.


3 doesn't count because it's divisible by 3


- 4 is divisible by 2, but not 3 or 5, so we count four numbers


And so on.


- 5 is not divisible by 2, so we count five numbers.
- 6 is divisible by 2 and 3, but not by 5, so we count six numbers.



I count 1, not 6




And the answer is: 6.


--
DaveA

--
https://mail.python.org/mailman/listinfo/python-list


parsing RSS XML feed for item value

2013-11-19 Thread Larry Wilson
Wanting to parse out the the temperature value in the "http://rss.weather.com.au/nsw/newcastle";
===


http://rss.weather.com.au/w.dtd";>

Weather.com.au - Newcastle Weather
http://www.weather.com.au/nsw/newcastle
Current conditions and forecast for Newcastle, New 
South Wales.
en-au
Copyright 2013 - Weather.com.au Pty Ltd
Tue, 19 Nov 2013 05:00:00 GMT
Tue, 19 Nov 2013 05:00:00 GMT
15

Newcastle Current Conditions

http://www.weather.com.au/nsw/newcastle/current



Tue, 19 Nov 2013 05:00:00 GMT
C1384837200



...etc
===
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Newbie - Trying to Help a Friend

2013-11-19 Thread Steven D'Aprano
On Tue, 19 Nov 2013 22:10:55 -0500, Dave Angel wrote:

> On 20 Nov 2013 00:17:23 GMT, Steven D'Aprano
>  wrote:
>> problem by hand. I'll get you started by solving the problem for 7.
> 
> 
> 
> 
>> Positive integers less than 23 are 1, 2, 3, 4, 5, 6. So let's start
>> checking them for divisors:
> 
> Where did 23 come from?

/head-desk

Sorry, first draft of this post was going to go up to 23.



>> - 1 is not divisible by 2, 3 or 5, so we count one number. - 2 is
>> divisible by 2, but not by 3 or 5, so we count two numbers.
> 
> 2 doesn't count because it's divisible by 2.

2 does count because it isn't divisible by 3. The question states, 
"[count] how many positive integers less than N are not divisible by 2,3 
or 5". Two is not divisible by 3, so "not divisible by 2,3 or 5" is true, 
so two gets counted.

The first number which is divisible by *all* of 2, 3 and 5 (i.e. fails 
the test, and therefore doesn't get counted) is 30. The next few that 
fail the test are 60, 90, 120, 150, 180, 210, 240, 270, 300, ... 
Remember, these are the numbers which should not be counted.


> I count 1, not 6

Out of curiosity, which number did you count?



-- 
Steven
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: parsing RSS XML feed for item value

2013-11-19 Thread xDog Walker
On Tuesday 2013 November 19 19:39, Larry Wilson wrote:
> Wanting to parse out the the temperature value in the " element, just after the guid element using ElementTree or xml.sax.

When you get tired of that, take a look at Universal Feedparser, a Python
Package:

http://code.google.com/p/feedparser/

http://packages.python.org/feedparser

-- 
Yonder nor sorghum stenches shut ladle gulls stopper torque wet 
strainers.


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Oh look, another language (ceylon)

2013-11-19 Thread Gregory Ewing

Steven D'Aprano wrote:

Which sum would that be?

Addition of vectors, matrices, quaternions, tensors, something else?


Considering vectors, multiplying a vector by a scalar
can be thought of as putting n copies of the vector
together nose-to-tail.

That's not very much different from putting n copies
of a string one after another.

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list


Re: Newbie - Trying to Help a Friend

2013-11-19 Thread Dave Angel
On 20 Nov 2013 03:52:10 GMT, Steven D'Aprano  
wrote:
2 does count because it isn't divisible by 3. The question states, 
"[count] how many positive integers less than N are not divisible 
by 2,3 
or 5". Two is not divisible by 3, so "not divisible by 2,3 or 5" is 
true, 

so two gets counted.


The first number which is divisible by *all* of 2, 3 and 5 (i.e. 
fails 
the test, and therefore doesn't get counted) is 30. The next few 
that 
fail the test are 60, 90, 120, 150, 180, 210, 240, 270, 300, ... 
Remember, these are the numbers which should not be counted.



> I count 1, not 6



Out of curiosity, which number did you count?


1 of course. It's the only one that's not divisible by any of the 
factors.


Apparently we disagree about precedence and associativity in English. 
I believe the not applies to the result of (divisible by 2, 3, or 5), 
so I'd count 1, 7, 11, 13, 17, 19, 23. The first nonprime would be 
49.


If I were trying to get the series you describe, I'd phrase it as 
 "Not divisible by 2, and not divisible by 3, and not divisible by 5"


--
DaveA

--
https://mail.python.org/mailman/listinfo/python-list


Re: pypix

2013-11-19 Thread Tim Roberts
Ajay Kumar  wrote:
>
>Hi Guys, i have created a site for Python Tutorials. here is the link 
>http://pypix.com/python/get-started-python-web-development/ . I would like to 
>have your opinion like what tutorials would you love to see.

Are you making a site for Python Tutorials, or tutorials for creating web
sites with Python?

Also, allow me to make one editorial note.  You say:

 Python is a general purpose programming language and is quickly
 becoming a must-have tool in the arsenal of any self-respecting
 programmer.

That statement was true in 1998.  Today, Python is a well-established and
mature programming tool.
-- 
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.
-- 
https://mail.python.org/mailman/listinfo/python-list


How to install pip for python3 on OS X?

2013-11-19 Thread Travis Griggs
OSX (Mavericks) has python2.7 stock installed. But I do all my own personal 
python stuff with 3.3. I just flushed my 3.3.2 install and installed the new 
3.3.3. So I need to install pyserial again. I can do it the way I've done it 
before, which is:

Download pyserial from pypi
untar pyserial.tgz
cd pyserial
python3 setup.py install
But I'd like to do like the cool kids do, and just do something like pip3 
install pyserial. But it's not clear how I get to that point. And just that 
point. Not interested (unless I have to be) in virtualenv yet.-- 
https://mail.python.org/mailman/listinfo/python-list


Re: HTTP Header Capitalization in urllib.request.AbstractHTTPHandler (Python 3.3)

2013-11-19 Thread Logan

Chris,

That is genius.  Thank you!

-- Logan
--
https://mail.python.org/mailman/listinfo/python-list


Re: HTTP Header Capitalization in urllib.request.AbstractHTTPHandler (Python 3.3)

2013-11-19 Thread Chris Angelico
On Wed, Nov 20, 2013 at 1:14 PM, Logan  wrote:
> Chris,
>
> That is genius.  Thank you!

Then it works? Awesome!! (Permit me an evil laugh. Muahahah!)

This is why I love working with open source languages. Even if you
don't end up actually changing anything, you can go and snoop the code
and see what happens - sometimes you can tweak your code based on that
knowledge. And hey. This is duck typing at its best!

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to install pip for python3 on OS X?

2013-11-19 Thread Ned Deily
In article <6856a21c-57e8-4cdd-a9e8-5dd738c36...@gmail.com>,
 Travis Griggs  wrote:

> OSX (Mavericks) has python2.7 stock installed. But I do all my own personal 
> python stuff with 3.3. I just flushed my 3.3.2 install and installed the new 
> 3.3.3. So I need to install pyserial again. I can do it the way I've done it 
> before, which is:
> 
> Download pyserial from pypi
> untar pyserial.tgz
> cd pyserial
> python3 setup.py install
> But I'd like to do like the cool kids do, and just do something like pip3 
> install pyserial. But it's not clear how I get to that point. And just that 
> point. Not interested (unless I have to be) in virtualenv 
> yet.-

http://www.pip-installer.org/en/latest/installing.html

# download and install setuptools
curl -O https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
python3 ez_setup.py
# download and install pip
curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py
python3 get-pip.py
# use pip to install
python3 -m pip install pyserial
# Don't want it?
python3 -m pip uninstall pyserial

-- 
 Ned Deily,
 n...@acm.org

-- 
https://mail.python.org/mailman/listinfo/python-list


  1   2   >