Re: [TIP] testfixtures 4.11.0 Released!

2016-10-12 Thread Chris Withers
*sigh*, it's 4.11.0 that was released with these changes... On 12/10/2016 17:06, Chris Withers wrote: Hi All, I'm pleased to announce the release of testfixtures 4.10.1 featuring the following: - Allow the attributes returned in LogCapture.actual() rows to be specified. - Allow a default

RE: smtplib TimeoutError not catch

2016-10-12 Thread Joaquin Alzola
>Not surprisingly, the exception you should catch is simply TimeoutError: >try: >server.sendmail(sender, receivers, msg.as_string()) >except TimeoutError as e: >print("SMTP could not be contacted: %s" % e) >finally: > server.quit() The error was thrown by a

Re: Scripting Help please

2016-10-12 Thread Terry Reedy
On 10/12/2016 4:37 PM, LongHairLuke wrote: Hi l am on my way to make a bot for the game Piano Tiles 2. But the code l have written so far saids invalid syntax at 2nd line. Here is my code: If you want to write Python code, start by working through the tutorial included with the docs. -- Terr

Re: Python-based monads essay (Re: Assignment versus binding)

2016-10-12 Thread Steve D'Aprano
On Wed, 12 Oct 2016 11:52 pm, Gregory Ewing wrote: > Steven D'Aprano wrote: >> "the implementation is free to use in-place mutations of the state object >> – ... without letting anyone know that the implementation has given up >> any functional purity." > > If it's impossible to tell that functio

Re: Scripting Help please

2016-10-12 Thread Wildman via Python-list
On Wed, 12 Oct 2016 20:48:31 +, alister wrote: > On Wed, 12 Oct 2016 13:37:23 -0700, LongHairLuke wrote: > >> Hi l am on my way to make a bot for the game Piano Tiles 2. >> But the code l have written so far saids invalid syntax at 2nd line. >> Here is my code: >> >> >> >> while True: >>

Re: How to process syntax errors

2016-10-12 Thread Terry Reedy
On 10/12/2016 5:59 AM, mr.puneet.go...@gmail.com wrote: # I created a platform class with different method in a file > # and making it as a package. class platform: def connect(self): # connect device def destroy(self): # destroy device def config(self, command):

Re: Scripting Help please

2016-10-12 Thread alister
On Wed, 12 Oct 2016 13:37:23 -0700, LongHairLuke wrote: > Hi l am on my way to make a bot for the game Piano Tiles 2. > But the code l have written so far saids invalid syntax at 2nd line. > Here is my code: > > > > while True: >If active then > FFSnapShot(areaX, areaY + height - offs

Scripting Help please

2016-10-12 Thread LongHairLuke
Hi l am on my way to make a bot for the game Piano Tiles 2. But the code l have written so far saids invalid syntax at 2nd line. Here is my code: while True: If active then FFSnapShot(areaX, areaY + height - offsetBottom, areaX + width, areaY + height - offsetBottom, sid) For

Re: smtplib TimeoutError not catch

2016-10-12 Thread MRAB
On 2016-10-12 14:21, Joaquin Alzola wrote: Hi Guys Try to connect to the smtp via smtplib. The connection is down because the Firewall has not been open yet so the exception is something that should appear. Now I want to catch this timeout in case error happens in future. Here the exception t

smtplib TimeoutError not catch

2016-10-12 Thread Joaquin Alzola
Hi Guys Try to connect to the smtp via smtplib. The connection is down because the Firewall has not been open yet so the exception is something that should appear. Now I want to catch this timeout in case error happens in future. Here the exception trace. [2016-10-12 14:14:06,289] ERROR in app

Re: How to process syntax errors

2016-10-12 Thread sohcahtoa82
On Wednesday, October 12, 2016 at 3:01:26 AM UTC-7, mr.pune...@gmail.com wrote: > Hi All > > Its really good to see that some discussion happening around this topic. > Sorry I was out from my work for sometime so couldn't follow up but I really > find it useful. It gives me good opportunity to k

Re: an other issue when installing python under Windows OS

2016-10-12 Thread eryk sun
On Wed, Oct 12, 2016 at 3:25 PM, eryk sun wrote: > On Wed, Oct 12, 2016 at 12:24 PM, Karlheinz Hoening wrote: >> >>on my iMac I have installed Windows (7) and I am now trying to install >>Python 3.5.2 (32-bit) under Windows OS. >>Every time after having 'repaired' with the installatio

Re: How to process syntax errors

2016-10-12 Thread Rob Gaddi
mr.puneet.go...@gmail.com wrote: > On Monday, October 10, 2016 at 7:45:40 PM UTC+5:30, mr.pune...@gmail.com > wrote: >> Hi >> >> Is there any way to capture syntax errors and process them ? I want to write >> a function which calls every time whenever there is syntax error in the >> program.

Re: How to process syntax errors

2016-10-12 Thread Steve D'Aprano
On Thu, 13 Oct 2016 12:46 am, Pierre-Alain Dorange wrote: > Terry Reedy wrote: > >> > Using this function, the code is "compiled". >> > I do not think this function is often used and most python project >> > simply use the interpreter (which do a small translation into byte-code >> > to be faste

testfixtures 4.11.0 Released!

2016-10-12 Thread Chris Withers
Hi All, I'm pleased to announce the release of testfixtures 4.10.1 featuring the following: - Allow the attributes returned in LogCapture.actual() rows to be specified. - Allow a default to be specified for encoding in TempDirectory.read() and TempDirectory.write(). The package is on PyP

Re: an other issue when installing python under Windows OS

2016-10-12 Thread eryk sun
On Wed, Oct 12, 2016 at 12:24 PM, Karlheinz Hoening wrote: > >on my iMac I have installed Windows (7) and I am now trying to install >Python 3.5.2 (32-bit) under Windows OS. >Every time after having 'repaired' with the installation procedere I >receive the following message when st

Re: How to process syntax errors

2016-10-12 Thread Chris Angelico
On Thu, Oct 13, 2016 at 12:46 AM, Pierre-Alain Dorange wrote: > Terry Reedy wrote: > >> > Using this function, the code is "compiled". >> > I do not think this function is often used and most python project >> > simply use the interpreter (which do a small translation into byte-code >> > to be fa

Re: How to process syntax errors

2016-10-12 Thread Pierre-Alain Dorange
Terry Reedy wrote: > > Using this function, the code is "compiled". > > I do not think this function is often used and most python project > > simply use the interpreter (which do a small translation into byte-code > > to be faster and check syntax error before running interpretation > > You see

Re: an other issue when installing python under Windows OS

2016-10-12 Thread Vlastimil Brom
2016-10-12 14:24 GMT+02:00 Karlheinz Hoening : >Hello all, > >on my iMac I have installed Windows (7) and I am now trying to install >Python 3.5.2 (32-bit) under Windows OS. >Every time after having 'repaired' with the installation procedere I >receive the following message when

Re: Python-based monads essay (Re: Assignment versus binding)

2016-10-12 Thread Gregory Ewing
Steven D'Aprano wrote: "the implementation is free to use in-place mutations of the state object – ... without letting anyone know that the implementation has given up any functional purity." If it's impossible to tell that functional purity has been given up, then in what sense has it been gi

an other issue when installing python under Windows OS

2016-10-12 Thread Karlheinz Hoening
Hello all, on my iMac I have installed Windows (7) and I am now trying to install Python 3.5.2 (32-bit) under Windows OS. Every time after having 'repaired' with the installation procedere I receive the following message when starting Python 3.5:

Re: Local variables to a function doesn't disapear after function execution. Why ?

2016-10-12 Thread ast
"Christian Gollwitzer" a écrit dans le message de news:ntl6in$on5$1...@dont-email.me... Am 12.10.16 um 13:18 schrieb ast: Because the Test() call does never terminate. You have the mainloop inside of your constructor. As long as this loop runs, your program exists. Try it by putting test=

Re: Local variables to a function doesn't disapear after function execution. Why ?

2016-10-12 Thread Christian Gollwitzer
Am 12.10.16 um 13:18 schrieb ast: Hello, here is the small program: from tkinter import * class Test: def __init__(self): root = Tk() label = Label(root, text="this is a test") label.pack() root.mainloop() test=Test() I dont understand why this program works. Af

Local variables to a function doesn't disapear after function execution. Why ?

2016-10-12 Thread ast
Hello, here is the small program: from tkinter import * class Test: def __init__(self): root = Tk() label = Label(root, text="this is a test") label.pack() root.mainloop() test=Test() I dont understand why this program works. After execution of function __init__,

Re: How to process syntax errors

2016-10-12 Thread Steve D'Aprano
On Wed, 12 Oct 2016 08:59 pm, mr.puneet.go...@gmail.com wrote: > Now person who wants to write a script using above package can simply use > below approach. Which does not make him to have knowledge in python. > > DUT = platform() > DUT connect > DUT config {commands} > DUT show {commands} > DUT

Re: [RELEASE] Python 3.6.0b2 is now available

2016-10-12 Thread Robin Becker
On 11/10/2016 02:12, Ned Deily wrote: On behalf of the Python development community and the Python 3.6 release team, I'm happy to announce the availability of Python 3.6.0b2. 3.6.0b2 is the second of four planned beta releases of Python 3.6, the next major release of Python, and marks the end of

Re: while loop (Reposting On Python-List Prohibited)

2016-10-12 Thread BartC
On 12/10/2016 11:15, Peter Otten wrote: BartC wrote: On 12/10/2016 05:30, Lawrence D’Oliveiro wrote: On Wednesday, October 12, 2016 at 11:23:48 AM UTC+13, BartC wrote: while n>=x: n=n-1 print "*"* n else: print ("2nd loop exit n=",n,"x=",x) What is the difference between that

Re: repr/str diff between Python 2 and 3

2016-10-12 Thread Skip Montanaro
Thanks everyone. I'm not going to try to be too cute, and will just change my test case. I'm leaving Python 2 behind in this particular case for now anyway. I can always return to the issue if I decide I need Python 2.7 support at some point in the future. Skip -- https://mail.python.org/mailman/

Re: while loop (Reposting On Python-List Prohibited)

2016-10-12 Thread Peter Otten
BartC wrote: > On 12/10/2016 05:30, Lawrence D’Oliveiro wrote: >> On Wednesday, October 12, 2016 at 11:23:48 AM UTC+13, BartC wrote: >>> while n>=x: >>> n=n-1 >>> print "*"* n >>> else: >>> print ("2nd loop exit n=",n,"x=",x) >> >> What is the difference between that and >> >> w

Re: How to process syntax errors

2016-10-12 Thread mr . puneet . goyal
On Monday, October 10, 2016 at 7:45:40 PM UTC+5:30, mr.pune...@gmail.com wrote: > Hi > > Is there any way to capture syntax errors and process them ? I want to write > a function which calls every time whenever there is syntax error in the > program. > > For example, > > inside example.py >

Re: how to evaluate a ast tree and change Add to Multiply ?

2016-10-12 Thread meInvent bbird
i just expect to rewrite + become multiply by edit the example in the link provided but search no examples about this, feel unknown about args and keywords etc, do not know how to write this ast.Call(func=ast.Name(id='Add', ctx=ast.Load()), args=[node], keywords=[

Re: how to evaluate a ast tree and change Add to Multiply ?

2016-10-12 Thread meInvent bbird
i use example here http://greentreesnakes.readthedocs.io/en/latest/examples.html On Wednesday, October 12, 2016 at 5:47:12 PM UTC+8, Chris Angelico wrote: > On Wed, Oct 12, 2016 at 8:32 PM, meInvent bbird wrote: > > class ChangeAddtoMultiply(ast.NodeTransformer): > > """Wraps all intege

Re: How to process syntax errors

2016-10-12 Thread mr . puneet . goyal
Hi All Its really good to see that some discussion happening around this topic. Sorry I was out from my work for sometime so couldn't follow up but I really find it useful. It gives me good opportunity to know python better as I recently started learning python. Ok so I tell you why I need to

Re: while loop (Reposting On Python-List Prohibited)

2016-10-12 Thread BartC
On 12/10/2016 05:30, Lawrence D’Oliveiro wrote: On Wednesday, October 12, 2016 at 11:23:48 AM UTC+13, BartC wrote: while n>=x: n=n-1 print "*"* n else: print ("2nd loop exit n=",n,"x=",x) What is the difference between that and while n>=x: n=n-1 print "*"*

how to faster to know which ast name or id we want to change?

2016-10-12 Thread meInvent bbird
how to faster to know which ast name or id we want to change? because i use ast.walk to print all nodes then i know the name + is Add if using cparser to parse linux kernel, it will be a very large -- https://mail.python.org/mailman/listinfo/python-list

Re: how to evaluate a ast tree and change Add to Multiply ?

2016-10-12 Thread Chris Angelico
On Wed, Oct 12, 2016 at 8:32 PM, meInvent bbird wrote: > class ChangeAddtoMultiply(ast.NodeTransformer): > """Wraps all integers in a call to Integer()""" > def visit_Num(self, node): > if isinstance(node.n, int): > return ast.Call(func=ast.Name(id='Add', ctx=ast.Load()

how to evaluate a ast tree and change Add to Multiply ?

2016-10-12 Thread meInvent bbird
import sys import parser import ast from collections import deque class ChangeAddtoMultiply(ast.NodeTransformer): """Wraps all integers in a call to Integer()""" def visit_Num(self, node): if isinstance(node.n, int): return ast.Call(func=ast.Name(id='Add', ctx=ast.Load

why solveset and dsolve do not have _fields for ast.walk?

2016-10-12 Thread meInvent bbird
Traceback (most recent call last): File "astgraphforsympy.py", line 86, in print get_func_calls(tree) File "astgraphforsympy.py", line 48, in get_func_calls for node in ast.walk(tree): File "C:\Python27\lib\ast.py", line 213, in walk todo.extend(iter_child_nodes(node)) File "C:

Re: Python-based monads essay (Re: Assignment versus binding)

2016-10-12 Thread Steven D'Aprano
On Sunday 09 October 2016 18:48, Gregory Ewing wrote: > Here's the first part of the essay I said I'd write about > monads: > > http://www.cosc.canterbury.ac.nz/greg.ewing/essays/monads/DemystifyingMonads.html Quoting from the essay: "the implementation is free to use in-place mutations of th