Re: exist loop by pressing esc

2016-10-23 Thread Wildman via Python-list
On Sun, 23 Oct 2016 14:34:29 -0700, chris alindi wrote: > simple while loop range(10) if user press esc exits loop If I understand you correctly you want to exit a while loop with the ESC key. That can be done but it depends on the platform. For Windows use this: (not tested) import msvcrt wh

Re: exist loop by pressing esc

2016-10-23 Thread Steve D'Aprano
On Mon, 24 Oct 2016 08:34 am, chris alindi wrote: > simple while loop range(10) if user press esc exits loop Your post is not a question nor even a grammatical sentence? Would you like us to guess what you mean? Or perhaps you could ask your question in actual proper sentences? If English is no

Re: Has any one automated the vmware-vra setup using python?

2016-10-23 Thread grant . a . orchard
On Thursday, 6 October 2016 04:36:15 UTC+11, Robert Clove wrote: > Not yet. There are a few people working towards it though. Grant -- https://mail.python.org/mailman/listinfo/python-list

exist loop by pressing esc

2016-10-23 Thread chris alindi
simple while loop range(10) if user press esc exits loop -- https://mail.python.org/mailman/listinfo/python-list

Re: Internet Data Handling » mailbox

2016-10-23 Thread Jon Ribbens
On 2016-10-23, Jason Friedman wrote: >> >> for message in mailbox.mbox(sys.argv[1]): >> if message.has_key("From") and message.has_key("To"): >> addrs = message.get_all("From") >> addrs.extend(message.get_all("To")) >> for addr in addrs: >>

Re: Internet Data Handling » mailbox

2016-10-23 Thread Jon Ribbens
On 2016-10-23, Jon Ribbens wrote: > On 2016-10-23, Jason Friedman wrote: >>> >>> for message in mailbox.mbox(sys.argv[1]): >>> if message.has_key("From") and message.has_key("To"): >>> addrs = message.get_all("From") >>> addrs.extend(message.get_all("To"))

Re: Quick way to calculate lines of code/comments in a collection of Python scripts?

2016-10-23 Thread Tomasz Rola
On Wed, Oct 05, 2016 at 01:56:59PM -0400, Malcolm Greene wrote: > Looking for a quick way to calculate lines of code/comments in a > collection of Python scripts. This isn't a LOC per day per developer > type analysis - I'm looking for a metric to quickly judge the complexity > of a set of scripts

Re: multiprocess passing arguments double asterisks

2016-10-23 Thread Thomas Nyberg
On 10/23/2016 03:12 AM, pic8...@gmail.com wrote: import multiprocessing as mp def bar(**kwargs): for a in kwargs: print a,kwargs[a] arguments={'name':'Joe','age':20} p=mp.Pool(processes=4) p.map(bar,**arguments) p.close() p.join() What are you trying to do? The map method is similar

Re: Internet Data Handling » mailbox

2016-10-23 Thread Jason Friedman
> > for message in mailbox.mbox(sys.argv[1]): > if message.has_key("From") and message.has_key("To"): > addrs = message.get_all("From") > addrs.extend(message.get_all("To")) > for addr in addrs: > addrl = addr.lower() >

RE: MySQL connector issue

2016-10-23 Thread Joseph L. Casale
> Interesting. Generally, I allocate cursors exactly at the same time as I open > transactions; > not sure if this works with the mysql connector, but with psycopg2 > (PostgreSQL), my code looks like this: > > with conn, conn.cursor() as cur: > cur.execute(...) > ... = cur.fetchall() > >

Re: Obtain javascript result

2016-10-23 Thread eproser
Ok, I solved to this way: from bs4 import BeautifulSoup from selenium import webdriver driver = webdriver.Chrome() driver.get('http://www.betexplorer.com/soccer/russia/youth-\league/matchdetails.php?matchid=rLu2Xsdi') pg_src = driver.page_source driver.close() soup = BeautifulSoup(pg_src, 'html.

Re: MySQL connector issue

2016-10-23 Thread Chris Angelico
On Mon, Oct 24, 2016 at 3:46 AM, Joseph L. Casale wrote: > It really is that simple which is why I am baffled. Given the throughput is so > low, if I close the cursor and connection at the end of loop and instantiate > them > both at the start of the loop, it works as expected but that's obviousl

RE: MySQL connector issue

2016-10-23 Thread Joseph L. Casale
> Perhaps you simplified too much, but changes between the select and the > update could be lost. I think you need at least three states: > > 1 mark rows where baz is null (by setting baz to some value other than NULL > or 42, 24, say: set baz = 24 where baz is NULL) > 2 show marked rows (select

Re: MySQL connector issue

2016-10-23 Thread Peter Otten
Joseph L. Casale wrote: > I have some code that I am testing on Windows without c extensions which > runs on a RHEL server with c extensions. In a simplified test case as > follows: > > connection = mysql.connector.connect(...) > cursor = connection.cursor(cursor_class=MySQLCursorDict) > while Tr

MySQL connector issue

2016-10-23 Thread Joseph L. Casale
I have some code that I am testing on Windows without c extensions which runs on a RHEL server with c extensions. In a simplified test case as follows: connection = mysql.connector.connect(...) cursor = connection.cursor(cursor_class=MySQLCursorDict) while True: cursor.execute('SELECT foo,biz

Re: function call questions

2016-10-23 Thread chenyong20000
在 2016年10月22日星期六 UTC+8下午9:15:06,Frank Millman写道: > wrote in message > news:9c91a4cf-1f3e-43b3-b75c-afc96b0b4...@googlegroups.com... > > > I have read Anssi's post already before I sent the post. To be frankly, I > can't understand why he got the right answer. I'm sorry for my silly. "So > when we

Re: Odd name shadowing in comprehension

2016-10-23 Thread eryk sun
On Sun, Oct 23, 2016 at 6:15 AM, Steve D'Aprano wrote: > On Sun, 23 Oct 2016 01:15 pm, eryk sun wrote: > >> I meant the behavior seems to have been copied to align with generator >> expressions, even though the cited rationale doesn't apply. I'm not >> saying this is wrong. It's useful that the ex

Re: Internet Data Handling » mailbox

2016-10-23 Thread andy
Sat, 22 Oct 2016 19:41:45 -0400 wrote Adam Jensen: > On 10/22/2016 05:47 AM, andy wrote: >> I would type: help(mailbox) after importing it. > > I guess the output of that might be more meaningful once I understand > the underlying structures and conventions. yes - you are right. fortunatelly pyt

multiprocess passing arguments double asterisks

2016-10-23 Thread pic8690
import multiprocessing as mp def bar(**kwargs): for a in kwargs: print a,kwargs[a] arguments={'name':'Joe','age':20} p=mp.Pool(processes=4) p.map(bar,**arguments) p.close() p.join() Errors: Traceback (most recent call last): File "post.py", line 9, in p.map(bar,**arguments)

multiprocess passing arguments double asterisks

2016-10-23 Thread pic8690
import multiprocessing as mp def bar(**kwargs): for a in kwargs: print a,kwargs[a] arguments={'name':'Joe','age':20} p=mp.Pool(processes=4) p.map(bar,**arguments) p.close() p.join() Errors: Traceback (most recent call last): File "post.py", line 9, in p.map(bar,**arguments)