Re: cross platform alternative for signal.SIGALRM?

2015-11-11 Thread Chris Angelico
On Thu, Nov 12, 2015 at 5:43 PM, Christian Gollwitzer wrote: > My understanding of async is that it creates an event loop. In which case > the loop has no chance to run within a block of code that computes anything, > is that correct? This is correct. At its simplest, asynchronous code is an abst

Re: cross platform alternative for signal.SIGALRM?

2015-11-11 Thread Ulli Horlacher
Marko Rauhamaa wrote: > I'm thinking the only portable way is to run a watchdog process with > subprocess or multiprocessing. How can a subprocess interrupt a function in another process? For example: waiting for user input with a timeout. raw_input("Hit ENTER to continue or wait 10 s") --

Re: cross platform alternative for signal.SIGALRM?

2015-11-11 Thread Ulli Horlacher
Terry Reedy wrote: > On 11/11/2015 11:16 AM, Ulli Horlacher wrote: > > I am rewriting a Perl program into Python (2.7). > > I recommend using 3.4+ if you possibly can. It is not possible. The main target platform offers only python 2.7 -- Ullrich Horlacher Server und Virtualisieru

Re: cross platform alternative for signal.SIGALRM?

2015-11-11 Thread Christian Gollwitzer
Am 12.11.15 um 07:14 schrieb Marko Rauhamaa: Terry Reedy : The cross-platform 3.4 asyncio module has some functions with timeouts. Even that doesn't forcefully interrupt an obnoxious blocking function call like time.sleep(1) A blocking call - granted. But what happens in a blocking

Re: new to python, help please !!

2015-11-11 Thread Marko Rauhamaa
Steven D'Aprano : > On Thursday 12 November 2015 04:48, Quivis wrote: > >> On Wed, 11 Nov 2015 08:34:30 -0800, Anas Belemlih wrote: >> >>> md5 >> >> If those are md5 values stored inside files, wouldn't it be easier to >> just hash them? >> >> import hashlib >> >> m1 = hashlib.sha224(open('f1'

Re: cross platform alternative for signal.SIGALRM?

2015-11-11 Thread Marko Rauhamaa
Terry Reedy : > The cross-platform 3.4 asyncio module has some functions with > timeouts. Even that doesn't forcefully interrupt an obnoxious blocking function call like time.sleep(1) The original question claimed signal.alarm() would do the trick in Linux. However, even that cannot be r

Re: cross platform alternative for signal.SIGALRM?

2015-11-11 Thread Cameron Simpson
On 11Nov2015 16:16, Ulli Horlacher wrote: I am rewriting a Perl program into Python (2.7). It must run on Linux and Windows. With Linux I have no problems, but Windows... :-( The current show stopper is signal.SIGALRM which is not available on Windows: File "fexit.py", line 674, in formdata_p

Re: Python.exe is not a valid Win32 application error message

2015-11-11 Thread Steve Hayes
On Wed, 11 Nov 2015 08:39:21 -0500, Dennis Lee Bieber wrote: >On Tue, 10 Nov 2015 00:34:23 + (UTC), "M. Kamisato via Python-list" > declaimed the following: > >>I am running python on Windows XP SP3 and download version 3.5xx.  I got the >>above error message and could not run the program. >

Re: Python.exe is not a valid Win32 application error message

2015-11-11 Thread Steve Hayes
On Thu, 12 Nov 2015 00:13:29 +1100, Chris Angelico wrote: >On Tue, Nov 10, 2015 at 11:34 AM, M. Kamisato via Python-list > wrote: >> I am running python on Windows XP SP3 and download version 3.5xx. I got the >> above error message and could not run the program. >> I have downloaded Python vers

Re: How to get 'od' run?

2015-11-11 Thread Michael Torrie
On 11/11/2015 08:21 PM, Michael Torrie wrote: > On 11/11/2015 08:04 PM, fl wrote: >> Hi, >> >> I am learning python. I see a previous post has such code: >> >> >> >> >> >>>>> data = '"binääridataa"\n'.encode('utf-8') >>>>> f = open('roska.txt', 'wb') >>>>> f.write(data) >>17 >>

Re: How to get 'od' run?

2015-11-11 Thread Michael Torrie
On 11/11/2015 08:04 PM, fl wrote: > Hi, > > I am learning python. I see a previous post has such code: > > > > > >>>> data = '"binääridataa"\n'.encode('utf-8') >>>> f = open('roska.txt', 'wb') >>>> f.write(data) >17 >>>> f.close() > > The .encode methods produced a b

How to get 'od' run?

2015-11-11 Thread fl
Hi, I am learning python. I see a previous post has such code: >>> data = '"binääridataa"\n'.encode('utf-8') >>> f = open('roska.txt', 'wb') >>> f.write(data) 17 >>> f.close() The .encode methods produced a bytestring, which Python likes to display as ASCII characters wh

Re: new to python, help please !!

2015-11-11 Thread Steven D'Aprano
On Thursday 12 November 2015 04:48, Quivis wrote: > On Wed, 11 Nov 2015 08:34:30 -0800, Anas Belemlih wrote: > >> md5 > > If those are md5 values stored inside files, wouldn't it be easier to > just hash them? > > import hashlib > > m1 = hashlib.sha224(open('f1').read()).hexdigest() > m2 = has

Re: More tkinter Madness

2015-11-11 Thread Chris Angelico
On Thu, Nov 12, 2015 at 12:52 PM, Tim Daneliuk wrote: > I am the author of twander (https://www.tundraware.com/Software/twander). > This code has run flawlessly for years on FreeBSD, Linux, MacOS and > Windows. Some months ago, I put it on a couple of VPS servers (FreeBSD > and Linux) and BOOM, i

Re: More tkinter Madness

2015-11-11 Thread Paul Rubin
Tim Daneliuk writes: > Some months ago, I put it on a couple of VPS servers (FreeBSD > and Linux) and BOOM, it doesn't run. I asked around here and got some > suggestions and then did some homework. I'd expect a VPS server to have no display--is it an X client forward to your workstation? Are a

More tkinter Madness

2015-11-11 Thread Tim Daneliuk
I am the author of twander (https://www.tundraware.com/Software/twander). This code has run flawlessly for years on FreeBSD, Linux, MacOS and Windows. Some months ago, I put it on a couple of VPS servers (FreeBSD and Linux) and BOOM, it doesn't run. I asked around here and got some suggestions an

Re: cross platform alternative for signal.SIGALRM?

2015-11-11 Thread Terry Reedy
On 11/11/2015 11:16 AM, Ulli Horlacher wrote: I am rewriting a Perl program into Python (2.7). I recommend using 3.4+ if you possibly can. It must run on Linux and Windows. With Linux I have no problems, but Windows... :-( The current show stopper is signal.SIGALRM which is not available on

Re: cross platform alternative for signal.SIGALRM?

2015-11-11 Thread Ulli Horlacher
Marko Rauhamaa wrote: > Correct. The timer callback function (hello) would be called in a > separate thread. An exception raised in one thread cannot be caught in > the main thread. In general, there is no way for a thread to interrupt a > sibling thread that is in a blocking function call. Then

Re: using binary in python

2015-11-11 Thread Christian Gollwitzer
Am 10.11.15 um 22:29 schrieb kent nyberg: On Mon, Nov 09, 2015 at 10:20:25PM -0800, Larry Hudson via Python-list wrote: Your questions are somewhat difficult to answer because you misunderstand binary. The key is that EVERYTHING in a computer is binary. There are NO EXCEPTIONS, it's all binary

Re: Using subprocess to capture a progress line

2015-11-11 Thread Tim Johnson
* Chris Warrick [15 07:54]: > On 11 November 2015 at 17:16, Tim Johnson wrote: > >> (2) [don’t do it] do you need to intercept the lines? If you don’t set > >> stderr= and stdout=, things will print just fine. > > Got to try that before using the module, just for edification. > > At which

Re: cross platform alternative for signal.SIGALRM?

2015-11-11 Thread Marko Rauhamaa
Ulli Horlacher : > Hmmm... not so simple for me. My test code: > > from time import * > import threading > import sys > > def hello(): > raise ValueError("hello!!!") > > t = threading.Timer(3.0,hello) > t.start() > try: > print "start" > sleep(5) > print "end" > except ValueError as e: >

Re: Python.exe is not a valid Win32 application error message

2015-11-11 Thread Michael Torrie
On 11/11/2015 10:21 AM, Quivis wrote: > On Tue, 10 Nov 2015 00:34:23 +, M. Kamisato wrote: > >> I am running python on Windows XP SP3 and download version 3.5xx. I got >> the above error message and could not run the program. >> I have downloaded Python version 2.7xx and it runs fine. >> Is t

Re: new to python, help please !!

2015-11-11 Thread Ben Finney
Anas Belemlih writes: > i am a beginning programmer, i am trying to write a simple code to > compare two character sets in 2 seperate files. ( 2 hash value files > basically) Welcome, and congratulations on arriving at Python for your programming! As a beginning programmer, you will benefit f

Re: cross platform alternative for signal.SIGALRM?

2015-11-11 Thread Ulli Horlacher
Marko Rauhamaa wrote: > Ulli Horlacher : > > > What is the best practise for a cross platform timeout handler? > > Here's the simplest answer: > >https://docs.python.org/3/library/threading.html#threading.Timer > > (Also available in Python 2.) Hmmm... not so simple for me. My test code:

Re: new to python, help please !!

2015-11-11 Thread Tim Chase
On 2015-11-11 08:34, Anas Belemlih wrote: > i am a beginning programmer, i am trying to write a simple code > to compare two character sets in 2 seperate files. ( 2 hash value > files basically) idea is: open both files, measure the length of > the loop on. > > if the length doesn't match, ==

Re: new to python, help please !!

2015-11-11 Thread John Gordon
In <93aef8e5-3d6f-41f4-a625-cd3c20076...@googlegroups.com> Anas Belemlih writes: > i=0 > s1=line1[i] > s2=line2[i] > count = 0 > if number1 != number2: > print " hash table not the same size" > else: > while count < number1: > if s1 == s2: > print " character", lin

Re: Using subprocess to capture a progress line

2015-11-11 Thread Chris Warrick
On 11 November 2015 at 17:16, Tim Johnson wrote: >> (2) [don’t do it] do you need to intercept the lines? If you don’t set >> stderr= and stdout=, things will print just fine. > Got to try that before using the module, just for edification. At which point your initial code sample will become: #

Re: cross platform alternative for signal.SIGALRM?

2015-11-11 Thread Marko Rauhamaa
Ulli Horlacher : > What is the best practise for a cross platform timeout handler? Here's the simplest answer: https://docs.python.org/3/library/threading.html#threading.Timer (Also available in Python 2.) Marko -- https://mail.python.org/mailman/listinfo/python-list

new to python, help please !!

2015-11-11 Thread Anas Belemlih
i am a beginning programmer, i am trying to write a simple code to compare two character sets in 2 seperate files. ( 2 hash value files basically) idea is: open both files, measure the length of the loop on. if the length doesn't match, == files do not match if length matchs, loop while c

cross platform alternative for signal.SIGALRM?

2015-11-11 Thread Ulli Horlacher
I am rewriting a Perl program into Python (2.7). It must run on Linux and Windows. With Linux I have no problems, but Windows... :-( The current show stopper is signal.SIGALRM which is not available on Windows: File "fexit.py", line 674, in formdata_post signal.signal(signal.SIGALRM,timeout

Re: Using subprocess to capture a progress line

2015-11-11 Thread Tim Johnson
* Chris Warrick [15 00:55]: > On 10 November 2015 at 23:47, Tim Johnson wrote: > > Using python 2.7.6 on ubuntu 14.04 <..> > There is no \n character at the end — which means that > p.stdout.readline() cannot return. In fact, if you printed repr() of > the line you read, you would get this:

Re: Python.exe is not a valid Win32 application error message

2015-11-11 Thread Michael Torrie
On 11/11/2015 06:13 AM, Chris Angelico wrote: > On Tue, Nov 10, 2015 at 11:34 AM, M. Kamisato via Python-list > wrote: >> I am running python on Windows XP SP3 and download version 3.5xx. I got the >> above error message and could not run the program. >> I have downloaded Python version 2.7xx an

Re: Python.exe is not a valid Win32 application error message

2015-11-11 Thread Chris Angelico
On Tue, Nov 10, 2015 at 11:34 AM, M. Kamisato via Python-list wrote: > I am running python on Windows XP SP3 and download version 3.5xx. I got the > above error message and could not run the program. > I have downloaded Python version 2.7xx and it runs fine. > Is there any way I can get version

Re: Guide in Deskop Application Development in Python for newbies

2015-11-11 Thread Leonard Andrew Mesiera
Thank you sir @Chris Warrick for your great suggestion, even though I really got overwhelmed by the things that I need to study to get this project done. I'm really new to programming so I havent heard or even tried DJANGO, but on your suggestion, if thats what I need to get my project done, that

Python.exe is not a valid Win32 application error message

2015-11-11 Thread M. Kamisato via Python-list
I am running python on Windows XP SP3 and download version 3.5xx.  I got the above error message and could not run the program. I have downloaded Python version 2.7xx and it runs fine. Is there any way I can get version 3.5xx to run on my computer? Mel KamisatoBuena Park, CA -- https://mail.pytho

Re: Guide in Deskop Application Development in Python for newbies

2015-11-11 Thread Leonard Andrew Mesiera
Thank you sir @Chris Warrick for your great suggestion, even though I really got overwhelmed by the things that I need to study to get this project done. I'm really new to programming so I havent heard or even tried DJANGO, but on your suggestion, if thats what I need to get my project done, that

Re: Question about math.pi is mutable

2015-11-11 Thread Steven D'Aprano
On Wed, 11 Nov 2015 07:30 pm, Marko Rauhamaa wrote: > Steven D'Aprano : > >> Since compile, eval and exec are Python built-ins, if it doesn't >> include a byte-code compiler, it isn't Python. It's just a subset of >> Python. > > compile() can be implemented trivially, or in any other manner. It

Re: Using subprocess to capture a progress line

2015-11-11 Thread Chris Warrick
On 10 November 2015 at 23:47, Tim Johnson wrote: > Using python 2.7.6 on ubuntu 14.04 > The application in question is run with bash and gnome-terminal : > > I've written a command-line "wrapper" for youtube-dl, executing > youtube-dl as a subprocess. > > --

Re: Question about math.pi is mutable

2015-11-11 Thread Marko Rauhamaa
Steven D'Aprano : > Since compile, eval and exec are Python built-ins, if it doesn't > include a byte-code compiler, it isn't Python. It's just a subset of > Python. compile() can be implemented trivially, or in any other manner. It simply needs to return a "code object." I suspect even a string