Re: How to flatten only one sub list of list of lists

2017-02-28 Thread Peter Otten
Sayth Renshaw wrote: > How can I flatten just a specific sublist of each list in a list of lists? > > So if I had this data > > > [ ['46295', 'Montauk', '3', '60', '85', ['19', '5', '1', '0 > [ [$277790.00']], > ['46295', 'Dark Eyes', '5', '59', '83', ['6', '4', '1', '0 > [$105625.0

Re: How to flatten only one sub list of list of lists

2017-02-28 Thread Jussi Piitulainen
Sayth Renshaw writes: > How can I flatten just a specific sublist of each list in a list of lists? > > So if I had this data > > > [ ['46295', 'Montauk', '3', '60', '85', ['19', '5', '1', '0 $277790.00']], > ['46295', 'Dark Eyes', '5', '59', '83', ['6', '4', '1', '0 $105625.00']], > ['46

How to flatten only one sub list of list of lists

2017-02-28 Thread Sayth Renshaw
How can I flatten just a specific sublist of each list in a list of lists? So if I had this data [ ['46295', 'Montauk', '3', '60', '85', ['19', '5', '1', '0 $277790.00']], ['46295', 'Dark Eyes', '5', '59', '83', ['6', '4', '1', '0 $105625.00']], ['46295', 'Machinegun Jubs', '6', '53',

[ANN] Aenum 2.0

2017-02-28 Thread Ethan Furman
For those following the latest Python releases you may have noticed that Python 3.6 Enum got two new types: - Flag - IntFlag Those classes have now been added to aenum (along with a bunch of bug fixes). aenum is available at: https://pypi.python.org/pypi/aenum Besides the four Enum types

Re: asyncio does not always show the full traceback

2017-02-28 Thread dieter
"Frank Millman" writes: > I use asyncio in my project, so most of my functions start with > 'async' and most of my calls are preceded by 'await'. > > If an exception is raised, I usually get the full traceback, but > sometimes I just get something like the following - > > Traceback (most recent ca

Re: asyncio does not always show the full traceback

2017-02-28 Thread Frank Millman
John Ladasky wrote in message news:72209011-db09-4ba2-9c5b-f576a30e2...@googlegroups.com... > Does anyone know what I must change to get the full traceback? Three years ago, I had a similar issue with incomplete tracebacks while using multiprocessing.Pool. The discussion is here: https://g

Re: Manual parameter substitution in sqlite3

2017-02-28 Thread Tim Chase
On 2017-03-01 04:40, Chris Angelico wrote: > curs.execute("select * from mumble where key in (" + > ",".join(["?"]*len(keys)) + ")", keys) > > If this is combined with another parameter, it'd be messier, but you > could do something like: > > curs.execute("select * from mumble where key in (" + >

Re: python-libxdo?

2017-02-28 Thread Jim
On 02/28/2017 04:05 AM, Pavol Lisy wrote: On 2/28/17, Jim wrote: simplified: from xdo import Xdo xdo = Xdo() win = xdo.search_windows(winname = 'Mozilla Firefox') File "/home/jfb/EVs/env/lib/python3.5/site-packages/xdo/__init__.py" TypeError: bytes or integer address expected instead of str i

Re: Exposing all methods of a class

2017-02-28 Thread Rick Johnson
On Sunday, February 26, 2017 at 2:15:58 PM UTC-6, Pete Dowdell wrote: > I use Python, mainly with Django, for work. I was wondering > if anyone has encountered an editor that could display a > class with all inherited methods included in the editor's > view of the class code. Personally, i'm a min

RE: Exposing all methods of a class

2017-02-28 Thread Deborah Swanson
Ethan Furman wrote, on February 28, 2017 8:23 AM > > On 02/26/2017 12:15 PM, Pete Dowdell wrote: > > > I was wondering if anyone has encountered an editor that > could display > > a class with all inherited methods included in the editor's view of > > the class code. > > I do not know of one,

Re: Crappy Python code of the day

2017-02-28 Thread Rick Johnson
On Wednesday, February 15, 2017 at 10:16:14 PM UTC-6, Steven D'Aprano wrote: > Oh, we know why the code is failing. We don't need help > diagnosing the UnboundLocalError exception. You're right: > there's an except pass around an assignment, so if the > assignment fails, `result` never gets set. >

Re: Manual parameter substitution in sqlite3

2017-02-28 Thread Neil Cerutti
On 2017-02-28, Skip Montanaro wrote: > Some database adapters provide a function to do explicit > substitution (e.g., mySQLdb.escape, psycopg2._param_escape), > but the sqlite3 adapter doesn't. It's clunky but you can use sqlite's core "quote" function. quote(X) The quote(X) function returns

Re: Manual parameter substitution in sqlite3

2017-02-28 Thread Skip Montanaro
On Tue, Feb 28, 2017 at 12:42 PM, Chris Angelico wrote: > That isn't what you were doing in your post, so it seemed worth > mentioning. Sorry, my original post was a bit abbreviated. I can't copy text from inside to outside, so have to retype everything. I guess I missed that. S -- https://mail

Re: asyncio does not always show the full traceback

2017-02-28 Thread jladasky
> Does anyone know what I must change to get the full traceback? Three years ago, I had a similar issue with incomplete tracebacks while using multiprocessing.Pool. The discussion is here: https://groups.google.com/forum/#!msg/comp.lang.python/qKTNNt8uKKU/biNyslh19ncJ;context-place=msg/comp.la

Online Python Editor with Live Syntax Checking

2017-02-28 Thread 17chiue
Hi everyone, I made a tool called PythonBuddy (http://pythonbuddy.com/). I made this so that MOOCs like edX or codecademy could easily embed and use this on their courses so students wouldn't have to go through the frustrations of setting up a Python environment and jump right into Python pro

Re: Exposing all methods of a class

2017-02-28 Thread Skip Montanaro
Might be worth checking out the speedbar package in GNU Emacs. I'm not sure if (or how) it might handle inheritance. Skip On Tue, Feb 28, 2017 at 10:23 AM, Ethan Furman wrote: > On 02/26/2017 12:15 PM, Pete Dowdell wrote: > >> I was wondering if anyone has encountered an editor that could displa

Re: Manual parameter substitution in sqlite3

2017-02-28 Thread Chris Angelico
On Wed, Mar 1, 2017 at 5:40 AM, Skip Montanaro wrote: > On Tue, Feb 28, 2017 at 11:40 AM, Chris Angelico wrote: >> Testing with PostgreSQL (which *does* transform lists) suggests that >> "in" doesn't work; I used "key = any(%s)". I'd try that with sqlite3 >> first, just in case it makes a differe

Re: Manual parameter substitution in sqlite3

2017-02-28 Thread Skip Montanaro
On Tue, Feb 28, 2017 at 11:40 AM, Chris Angelico wrote: > Testing with PostgreSQL (which *does* transform lists) suggests that > "in" doesn't work; I used "key = any(%s)". I'd try that with sqlite3 > first, just in case it makes a difference. Probably it won't, but > worth a try. Yeah, doesn't wo

Re: Manual parameter substitution in sqlite3

2017-02-28 Thread Peter Otten
Skip Montanaro wrote: > Most of the time (well, all the time if you're smart), you let the > database adapter do parameter substitution for you to avoid SQL > injection attacks (or stupid users). So: > > curs.execute("select * from mumble where key = ?", (key,)) > > If you want to select fro

Re: Manual parameter substitution in sqlite3

2017-02-28 Thread Chris Angelico
On Wed, Mar 1, 2017 at 4:28 AM, Skip Montanaro wrote: > Some database adapters provide a function to do explicit substitution > (e.g., mySQLdb.escape, psycopg2._param_escape), but the sqlite3 > adapter doesn't. Is there a function floating around out there which > does the right thing, allowing yo

Manual parameter substitution in sqlite3

2017-02-28 Thread Skip Montanaro
Most of the time (well, all the time if you're smart), you let the database adapter do parameter substitution for you to avoid SQL injection attacks (or stupid users). So: curs.execute("select * from mumble where key = ?", (key,)) If you want to select from several possible keys, it would be

Re: Exposing all methods of a class

2017-02-28 Thread Ethan Furman
On 02/26/2017 12:15 PM, Pete Dowdell wrote: I was wondering if anyone has encountered an editor that could display a class with all inherited methods included in the editor's view of the class code. I do not know of one, but agree it would be quite useful! -- ~Ethan~ -- https://mail.python.o

asyncio does not always show the full traceback

2017-02-28 Thread Frank Millman
Hi all I use asyncio in my project, so most of my functions start with 'async' and most of my calls are preceded by 'await'. If an exception is raised, I usually get the full traceback, but sometimes I just get something like the following - Traceback (most recent call last): File "C:\User

Re: pyaudio

2017-02-28 Thread Peter Otten
bogdan.dim...@gmail.com wrote: > I'm using pyaudio library and recieve after I run the code this message > > > Process finished with exit code -1 How did you invoke the script? When you run it from the command line, do you get a traceback? Once you have such a traceback please show it to us (

pyaudio

2017-02-28 Thread bogdan . dima06
I'm using pyaudio library and recieve after I run the code this message Process finished with exit code -1 Here is the whole code: import pyaudio import numpy as np p = pyaudio.PyAudio() volume = 0.5 # range [0.0, 1.0] fs = 44100 # sampling rate, Hz, must be integer duration = 10.0

Re: Insert blob data from one db to other db in oracle

2017-02-28 Thread Murthy Jn
On Tuesday, February 28, 2017 at 6:30:54 PM UTC+5:30, Murthy Jn wrote: > I have the table structure in one db is number,photo,date,name. > the same structure is there in other database in other machine. > > I want to insert table1 data from db1 into table2 in db2 using python script. > > Some one

Insert blob data from one db to other db in oracle

2017-02-28 Thread Murthy Jn
I have the table structure in one db is number,photo,date,name. the same structure is there in other database in other machine. I want to insert table1 data from db1 into table2 in db2 using python script. Some one could please help me in this.. I have tried like below. for fetching rows db conn

Re: Usage of ast.

2017-02-28 Thread Jon Ribbens
On 2017-02-28, Chris Angelico wrote: > On Tue, Feb 28, 2017 at 11:35 AM, Jon Ribbens > wrote: >> Sorry, I must have missed something here. What are you talking about? >> "lambda: [1,2,3]" is not acceptable input to ast.literal_eval(), it >> will throw an exception. > > [1,2,3] is, though. Go rea

Re: python-libxdo?

2017-02-28 Thread Pavol Lisy
On 2/28/17, Jim wrote: simplified: > from xdo import Xdo > xdo = Xdo() > win = xdo.search_windows(winname = 'Mozilla Firefox') > File "/home/jfb/EVs/env/lib/python3.5/site-packages/xdo/__init__.py" > TypeError: bytes or integer address expected instead of str instance Example on github seems to