Re: Keypress Input

2015-06-18 Thread Christian Gollwitzer
Am 15.06.15 um 07:15 schrieb John McKenzie: from Tkinter import * from blinkstick import blinkstick led = blinkstick.find_first() timered = 0 timeyellow = 0 timeblue = 0 colour = None root = Tk() root.title('eFlag 1') def red1(event): colour = 1 def yellow1(event): colour = 2

Re: JSON Object to CSV File Troubleshooting

2015-06-18 Thread Steve Hayes
On Thu, 18 Jun 2015 18:47:30 -0700 (PDT), Sahlusar wrote: >Good Evening, > >I have a conundrum regarding JSON objects and converting them to CSV: That's the THIRD time you've asked this, in three separate threads. Why don't you read the answers you were given the first time? [follow-ups set]

Re: JSON Object to CSV Question

2015-06-18 Thread Steve Hayes
On Wed, 17 Jun 2015 17:49:35 -0400, Saran Ahluwalia wrote: >Good Evening Everyone: > >I would like to have this JSON object written out to a CSV file so that the You've already said that in another thread, and got several answers. What are you? Some kind of troll? -- Steve Hayes from Tshwane,

JSON Object to CSV File Troubleshooting

2015-06-18 Thread Sahlusar
Good Evening, I have a conundrum regarding JSON objects and converting them to CSV: Context I am converting XML files to a JSON object (please see snippet below) and then finally producing a CSV file. Here is a an example JSON object: "PAC": {

Re: Python File as the Default PDF handler for Windows

2015-06-18 Thread Chris Angelico
On Fri, Jun 19, 2015 at 11:39 AM, MRAB wrote: > I don't think it should be "%s", but "%*". Thanks, it's been a while since I fiddled with Windows associations. ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: Python File as the Default PDF handler for Windows

2015-06-18 Thread MRAB
On 2015-06-19 02:18, Chris Angelico wrote: On Fri, Jun 19, 2015 at 11:03 AM, Naftali wrote: I may be missing something in your reply, but I am *not* wondering how to associate python with the .pdf file extension. That I know how to do. What I want to know is how from within the program that I

Re: Python File as the Default PDF handler for Windows

2015-06-18 Thread Naftali
On Thursday, June 18, 2015 at 5:05:15 PM UTC-4, Naftali wrote: > Long time lurker. > > I'm looking to register a python script as the default pdf reader for > windows. I assume I can just register the .py in the section windows section > for registering default handlers, but I'm wondering how t

Re: Python File as the Default PDF handler for Windows

2015-06-18 Thread Chris Angelico
On Fri, Jun 19, 2015 at 11:03 AM, Naftali wrote: > I may be missing something in your reply, but I am *not* wondering how to > associate python with the .pdf file extension. That I know how to do. What I > want to know is how from within the program that I've told windows to run > when the user

Re: Python File as the Default PDF handler for Windows

2015-06-18 Thread Naftali
On Thursday, June 18, 2015 at 5:05:15 PM UTC-4, Naftali wrote: > Long time lurker. > > I'm looking to register a python script as the default pdf reader for > windows. I assume I can just register the .py in the section windows section > for registering default handlers, but I'm wondering how t

Re: Documenting a function signature

2015-06-18 Thread Ben Finney
Laura Creighton writes: > In a message of Thu, 18 Jun 2015 10:04:46 +1000, Ben Finney writes: > >Since the introduction of keyword-only arguments in Python functions, > >the question arises of how to communicate this in documentation. > > I suppose it is way too late to scream "I hate keyword-onl

Re: Why this list of dictionaries doesn't work?

2015-06-18 Thread Steven D'Aprano
On Fri, 19 Jun 2015 03:57 am, Gilcan Machado wrote: > Hi, > > I'm trying to write a list of dictionaries like: > > people = ( > {'name':'john', 'age':12} , > {'name':'kacey', 'age':18} > ) > > > I've thought the code below would do the task. Why don't you just use exactl

Re: Python File as the Default PDF handler for Windows

2015-06-18 Thread Chris Angelico
On Fri, Jun 19, 2015 at 7:04 AM, Naftali wrote: > What I want to do is write a pdf handler to handle windows open instruction. > In the script I would run a command line pdf unlocker on the file and open > the unlocked file with adobe (or the like). > > I've googled and though I get tons of 'how

Re: Classic OOP in Python

2015-06-18 Thread Laura Creighton
In a message of Thu, 18 Jun 2015 11:50:28 +0100, Mark Lawrence writes: >Throw in http://clonedigger.sourceforge.net/ as well and you've a really >awesome combination. > >Mark Lawrence > I didn't know about that one. Hey thank you, Mark. Looks great. It needs its own entry in https://wiki.python

Re: Keypress Input

2015-06-18 Thread Michael Torrie
On 06/18/2015 01:35 PM, Oscar Benjamin wrote: > I use the following. I found in testing that when you push the button it > prints 'Button pressed' 10 times a second (in actual use it calls poweroff > so I guess bounce isn't an issue there). Is there some reason it needs to > be cleverer in this cas

Re: help in understanding the stackless code

2015-06-18 Thread Laura Creighton
You need to send your message over here. http://www.stackless.com/mailman/listinfo/stackless I think I know the answer, from my work in duplicating stackless for greenlets in pypy. But that's the answer in theory. In practice, you need real stackless users. Laura -- https://mail.python.org/ma

Re: Hotspot Locater

2015-06-18 Thread Laura Creighton
yes. wifi https://wifi.readthedocs.org/en/latest/ see this answer, not raspberry pi specific http://stackoverflow.com/questions/20470626/python-script-for-raspberrypi-to-connect-wifi-automatically but is linux specific, what OS do you need? Laura -- https://mail.python.org/mailman/listinfo/p

Re: Posting gzip'd image file - server says Malformed Upload?

2015-06-18 Thread Laura Creighton
I got to this party late. One way to get the malformed upload message is is you gzip something that already is gzipped, and send that up the pipe. worth checking. Laura -- https://mail.python.org/mailman/listinfo/python-list

Re: Documenting a function signature (was: Set a flag on the function or a global?)

2015-06-18 Thread Laura Creighton
In a message of Thu, 18 Jun 2015 10:04:46 +1000, Ben Finney writes: >Since the introduction of keyword-only arguments in Python functions, >the question arises of how to communicate this in documentation. I suppose it is way too late to scream "I hate keyword-only arguments"! >The lone asterisk s

Reassigning keys in dictionary of lists and then writing out to CSV file?

2015-06-18 Thread Sahlusar
I am currently attempting to work on converting a fairly sizeable JSON object and convert it into a CSV format. However, when I attempt to do so, using a conventional approach (that seems to work with other files). I am presented with a "ValueError: too many values to unpack" I have tried to fl

Python File as the Default PDF handler for Windows

2015-06-18 Thread Naftali
Long time lurker. I'm looking to register a python script as the default pdf reader for windows. I assume I can just register the .py in the section windows section for registering default handlers, but I'm wondering how to access the file from within the program. The issue is this: We have

Re: python program without stackless.run()

2015-06-18 Thread ravi
On Friday, June 19, 2015 at 1:41:36 AM UTC+5:30, Ian wrote: > On Thu, Jun 18, 2015 at 1:47 PM, ravi wrote: > > I could not understand how the below program executes function "fun" > > without calling stackless.run() in the program? Here "fun" runs as a > > tasklet and as per my knowledge for th

Re: python program without stackless.run()

2015-06-18 Thread Ian Kelly
On Thu, Jun 18, 2015 at 1:47 PM, ravi wrote: > I could not understand how the below program executes function "fun" without > calling stackless.run() in the program? Here "fun" runs as a tasklet and as > per my knowledge for that stackless.run() is must. You seem to have a lot of questions abo

how to dump tasklets status in python

2015-06-18 Thread ravi
hi, I have a complex python program running 100 tasklets simultaneously. I want to take dump of all the running tasklets including their current status and back trace at the time of exception. Can any one let me know how can this be done ? Thanks, ravi -- https://mail.python.org/mailman/listin

python program without stackless.run()

2015-06-18 Thread ravi
Hi, I could not understand how the below program executes function "fun" without calling stackless.run() in the program? Here "fun" runs as a tasklet and as per my knowledge for that stackless.run() is must. - import stackless

Re: help in understanding the stackless code

2015-06-18 Thread ravi
yes It has instance of both Reporter and Switch. moreover I could not get why instance "reporter" is passed to class Switch as a parameter ? > > reporter = Reporter() > > switch = Switch(0,reporter) > > switch(1) thanks On Thursday, June 18, 2015 at 5:45:08 PM UTC+5:30, MRAB w

Re: Keypress Input

2015-06-18 Thread Oscar Benjamin
On Wed, 17 Jun 2015 at 02:23 Michael Torrie wrote: > On 06/16/2015 02:49 PM, Grant Edwards wrote: > > On 2015-06-16, John McKenzie wrote: > > > >> It never occurred to me something so simple as keystrokes would not > >> be present in Python, a language rated as being terrific by everyone > >> I

Re: CLI Arguments That Call Functions?

2015-06-18 Thread Michael Torrie
On 06/18/2015 12:08 PM, Tony the Tiger wrote: > Forgot to add, I don't read or see anything posted from outside of the > groups. Posting from the mailing list here. I assume the nntp gateway is two-way. Unless you're manually blocking message originating in google groups, I don't see why you w

Re: CLI Arguments That Call Functions?

2015-06-18 Thread Ian Kelly
On Thu, Jun 18, 2015 at 11:56 AM, Tony the Tiger wrote: > I would have assumed there would be something built in to the > ArgumentParser, but I can't detect anything that seems to do what I want, > so I wrote the following: [SNIP] > So, is there something already in the Python libs? Do I continu

Re: Why this list of dictionaries doesn't work?

2015-06-18 Thread Gary Herron
On 06/18/2015 10:57 AM, Gilcan Machado wrote: Hi, I'm trying to write a list of dictionaries like: people = ( {'name':'john', 'age':12} , {'name':'kacey', 'age':18} ) I've thought the code below would do the task. But it doesn't work. Never say "it doesn't work" on th

Re: Why this list of dictionaries doesn't work?

2015-06-18 Thread MRAB
On 2015-06-18 18:57, Gilcan Machado wrote: Hi, I'm trying to write a list of dictionaries like: people = ( {'name':'john', 'age':12} , {'name':'kacey', 'age':18} ) That's not a list; it's a tuple. If you want a list, use '[' and ']'. I've thought the code below woul

Why this list of dictionaries doesn't work?

2015-06-18 Thread Gilcan Machado
Hi, I'm trying to write a list of dictionaries like: people = ( {'name':'john', 'age':12} , {'name':'kacey', 'age':18} ) I've thought the code below would do the task. But it doesn't work. And if I "print(people)" what I get is not the organize data structure like above.

Re: thinking with laziness

2015-06-18 Thread Todd
On Thu, Jun 18, 2015 at 6:15 PM, Mark Lawrence wrote: > On 18/06/2015 14:53, Steven D'Aprano wrote: > >> On Thu, 18 Jun 2015 11:10 pm, Neal Becker wrote: >> >> http://begriffs.com/posts/2015-06-17-thinking-with-laziness.html >>> >> >> I wanted to think about that post, but I'm too lazy to read i

Re: ctypes and byte order

2015-06-18 Thread Terry Reedy
On 6/18/2015 5:39 AM, Jean-Michel Pichavant wrote: I'm currently writing python code that writes a small binary file to be used by another device which code is written in C. The python code runs on a little endian CPU, and unfortunately, the other device is using a big endian MIPS. The struct

executable egg?

2015-06-18 Thread dmaziuk
Hi all, Here's my directory structure: myegg/ pkg1/ __init__.py ... pkg2/ __init__.py ... pkg3/ __init__.py ... setup.py I can make an egg with "python setup.py bdist_egg" and it works just fine. I'd like to make it executable with

Re: thinking with laziness

2015-06-18 Thread Chris Angelico
On Fri, Jun 19, 2015 at 2:15 AM, Mark Lawrence wrote: > Reminds me of last night's AGM of the Apathy Society, which was an > outstanding success as nobody turned up. How do you know for sure? Nobody bothered to take minutes. ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: thinking with laziness

2015-06-18 Thread Mark Lawrence
On 18/06/2015 14:53, Steven D'Aprano wrote: On Thu, 18 Jun 2015 11:10 pm, Neal Becker wrote: http://begriffs.com/posts/2015-06-17-thinking-with-laziness.html I wanted to think about that post, but I'm too lazy to read it. My-apologies-I-couldn't-resist-it-ly y'rs, Reminds me of last nigh

Re: Classic OOP in Python

2015-06-18 Thread Cousin Stanley
> > python -m doctest application.py > > And from there, I would build up extra doc tests > An extra doc test that fails #!/usr/bin/env python """ NewsGroup comp.lang.python Subject .. Classic OOP in Python Date . 2015-06-17 Post_By ..

Re: thinking with laziness

2015-06-18 Thread Steven D'Aprano
On Thu, 18 Jun 2015 11:10 pm, Neal Becker wrote: > http://begriffs.com/posts/2015-06-17-thinking-with-laziness.html I wanted to think about that post, but I'm too lazy to read it. My-apologies-I-couldn't-resist-it-ly y'rs, -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Time saving tips for Pythonists

2015-06-18 Thread John Strick
On Thursday, June 18, 2015 at 6:11:11 AM UTC-4, Productivi .co wrote: > What are your best time saving tips when programming Python? PyCharm! -- https://mail.python.org/mailman/listinfo/python-list

thinking with laziness

2015-06-18 Thread Neal Becker
http://begriffs.com/posts/2015-06-17-thinking-with-laziness.html -- https://mail.python.org/mailman/listinfo/python-list

Re: Posting gzip'd image file - server says Malformed Upload?

2015-06-18 Thread Chris Angelico
On Thu, Jun 18, 2015 at 10:38 PM, wrote: > On Wed, Jun 17, 2015, at 20:23, Chris Angelico wrote: >> On Thu, Jun 18, 2015 at 7:55 AM, Paul Hubert wrote: >> > f_in = open(dafile, 'rb') >> > f_out = gzip.open('/Users/Paul/Desktop/scripts/pic.jpg.gz', 'wb') >> > f_out.writelines(f_in) >> > f_out.clo

Re: Posting gzip'd image file - server says Malformed Upload?

2015-06-18 Thread random832
On Wed, Jun 17, 2015, at 20:23, Chris Angelico wrote: > On Thu, Jun 18, 2015 at 7:55 AM, Paul Hubert wrote: > > f_in = open(dafile, 'rb') > > f_out = gzip.open('/Users/Paul/Desktop/scripts/pic.jpg.gz', 'wb') > > f_out.writelines(f_in) > > f_out.close() > > f_in.close() > > Are you sure you want i

Re: Documenting a function signature (was: Set a flag on the function or a global?)

2015-06-18 Thread random832
On Wed, Jun 17, 2015, at 20:14, Chris Angelico wrote: > Mostly. That would imply that object is a mandatory parameter, which > AIUI isn't the case for Steven's edir. The downside of this kind of > signature is that it's hard to show the parameters that have unusual > defaults (either sentinel objec

Re: ctypes and byte order

2015-06-18 Thread Peter Otten
Jean-Michel Pichavant wrote: > - Original Message - >> From: "Peter Otten" <__pete...@web.de> >> becomes >> >> $ cat be2.py >> import ctypes, sys >> >> iarray_be = ctypes.c_uint32.__ctype_be__*5 >> >> class Foo_be(ctypes.BigEndianStructure): >> _fields_ = [('bar', iarray_be)] >>

Re: help in understanding the stackless code

2015-06-18 Thread MRAB
On 2015-06-18 08:41, ravi wrote: hi, I am new to python and need to know why the calling of switch(1) invokes the function "listen" twice in the below program? import stackless class EventHandler: def __init__(self,*outputs): if outputs==None: self.outputs=[]

Re: Classic OOP in Python

2015-06-18 Thread Ned Batchelder
On Thursday, June 18, 2015 at 7:21:29 AM UTC-4, Jason P. wrote: > El miércoles, 17 de junio de 2015, 21:44:51 (UTC+2), Ned Batchelder escribió: > > On Wednesday, June 17, 2015 at 3:21:32 PM UTC-4, Jason P. wrote: > > > Hello Python community. > > > > > > I come from a classic background in what r

Re: Classic OOP in Python

2015-06-18 Thread Chris Angelico
On Thu, Jun 18, 2015 at 9:03 PM, Fabien wrote: > Would you consider the following kind of program "unpythonic"? > > class MovingObject(object): > """Great doc about what a moving object is""" > > def move(self): > """Great doc about move""" > raise NotImplementedError() > >

Re: Classic OOP in Python

2015-06-18 Thread Marko Rauhamaa
Todd : > On Thu, Jun 18, 2015 at 1:03 PM, Fabien wrote: >> Would you consider the following kind of program "unpythonic"? >> >> class MovingObject(object): >> """Great doc about what a moving object is""" >> >> def move(self): >> """Great doc about move""" >> raise NotImpl

Re: Classic OOP in Python

2015-06-18 Thread Jason P.
El miércoles, 17 de junio de 2015, 22:39:31 (UTC+2), Marko Rauhamaa escribió: > Ned Batchelder : > > > TDD is about writing tests as a way to design the best system, and > > putting testing at the center of your development workflow. It works > > great with Python even without interfaces. > > I

Re: Classic OOP in Python

2015-06-18 Thread Jason P.
El miércoles, 17 de junio de 2015, 21:44:51 (UTC+2), Ned Batchelder escribió: > On Wednesday, June 17, 2015 at 3:21:32 PM UTC-4, Jason P. wrote: > > Hello Python community. > > > > I come from a classic background in what refers to OOP. Mostly Java and PHP > > (> 5.3). I'm used to abstract class

Re: ctypes and byte order

2015-06-18 Thread Jean-Michel Pichavant
- Original Message - > From: "Peter Otten" <__pete...@web.de> > becomes > > $ cat be2.py > import ctypes, sys > > iarray_be = ctypes.c_uint32.__ctype_be__*5 > > class Foo_be(ctypes.BigEndianStructure): > _fields_ = [('bar', iarray_be)] > > print sys.version > f_be = Foo_be((0,1,

Re: Classic OOP in Python

2015-06-18 Thread Jason P.
El miércoles, 17 de junio de 2015, 21:44:51 (UTC+2), Ned Batchelder escribió: > On Wednesday, June 17, 2015 at 3:21:32 PM UTC-4, Jason P. wrote: > > Hello Python community. > > > > I come from a classic background in what refers to OOP. Mostly Java and PHP > > (> 5.3). I'm used to abstract class

Re: Classic OOP in Python

2015-06-18 Thread Todd
On Thu, Jun 18, 2015 at 1:03 PM, Fabien wrote: > On 06/17/2015 11:16 PM, sohcahto...@gmail.com wrote: > >> You don't need interfaces with Python. Duck typing makes that all >> possible. >> > > Yes, but I also like interfaces (or in python: mimicked interfaces with > NotImplementedError) for thei

Re: Classic OOP in Python

2015-06-18 Thread Fabien
On 06/17/2015 11:16 PM, sohcahto...@gmail.com wrote: You don't need interfaces with Python. Duck typing makes that all possible. Yes, but I also like interfaces (or in python: mimicked interfaces with NotImplementedError) for their clarity and documentation purposes. Would you consider the

Re: Classic OOP in Python

2015-06-18 Thread Mark Lawrence
On 17/06/2015 23:33, Laura Creighton wrote: In a message of Wed, 17 Jun 2015 14:14:34 -0700, Ned Batchelder writes: TDD is supposed to make you brave, not cowards, and it's Ned's most excellent tool http://nedbatchelder.com/code/coverage/ that I recommend to TDD dogmatic cowards. Even if you d

Re: ctypes and byte order

2015-06-18 Thread Peter Otten
Jean-Michel Pichavant wrote: > I'm currently writing python code that writes a small binary file to be > used by another device which code is written in C. The python code runs on > a little endian CPU, and unfortunately, the other device is using a big > endian MIPS. > > My problem is the follow

Re: Get off the list

2015-06-18 Thread Cecil Westerhof
On Thursday 18 Jun 2015 09:36 CEST, Ian Kelly wrote: > On Thu, Jun 18, 2015 at 1:05 AM, Cecil Westerhof wrote: >> On Wednesday 17 Jun 2015 09:09 CEST, Deogratius Musiige wrote: >> >>> How can i get off this mailing list? >> >> Looking at the headers: List-Unsubscribe: >>

Time saving tips for Pythonists

2015-06-18 Thread Productivi .co
Hello Pythonists! I'm preparing an article to show up at simplilearn.com about the best time saving tips Pyhonists use, and thus, conducting interviews with Pythonists like you. The interview question I would like to ask you is: *What are your best time saving tips when programming Python?* Loo

Re: Get off the list

2015-06-18 Thread Ian Kelly
On Thu, Jun 18, 2015 at 1:05 AM, Cecil Westerhof wrote: > On Wednesday 17 Jun 2015 09:09 CEST, Deogratius Musiige wrote: > >> How can i get off this mailing list? > > Looking at the headers: > List-Unsubscribe: , >

Re: Classic OOP in Python

2015-06-18 Thread Marco Buttu
On 17/06/2015 23:33, sohcahto...@gmail.com wrote: I had a Java class where we had to learn TDD, and that's the way TDD was taught to us, and I hated it. We watched a video of this guy explaining TDD with a hat that was red on the front and green on the back. It involved writing a simple faili

ctypes and byte order

2015-06-18 Thread Jean-Michel Pichavant
Hi list, I'm currently writing python code that writes a small binary file to be used by another device which code is written in C. The python code runs on a little endian CPU, and unfortunately, the other device is using a big endian MIPS. My problem is the following: I cannot make an array of

Re: Get off the list

2015-06-18 Thread Marc Lucke
there is no way. You are trapped forever. Resistance is futile. On 17/06/2015 5:09 PM, Deogratius Musiige wrote: > Hi, > > How can i get off this mailing list? > > > > Best regards / Med venlig hilsen > > Deogratius Musiige > Software Development Engineer > > *Sennheiser Communications A/

help in understanding the stackless code

2015-06-18 Thread ravi
hi, I am new to python and need to know why the calling of switch(1) invokes the function "listen" twice in the below program? import stackless class EventHandler: def __init__(self,*outputs): if outputs==None: self.outputs=[] else: self.outputs=list

Re: JSON Object to CSV Question

2015-06-18 Thread Peter Otten
Saran Ahluwalia wrote: > Good Evening Everyone: > > I would like to have this JSON object written out to a CSV file so that > the keys are header fields (for each of the columns) and the values are > values that are associated with each header field. Is there a best > practice for working with th

Re: Get off the list

2015-06-18 Thread Cecil Westerhof
On Wednesday 17 Jun 2015 09:09 CEST, Deogratius Musiige wrote: > How can i get off this mailing list? Looking at the headers: List-Unsubscribe: , So I would send an email wi

JSON Object to CSV Question

2015-06-18 Thread Saran Ahluwalia
Good Evening Everyone: I would like to have this JSON object written out to a CSV file so that the keys are header fields (for each of the columns) and the values are values that are associated with each header field. Is there a best practice for working with this? Ideally I would like to recursiv

Re: JSON Object to CSV file

2015-06-18 Thread Sahlusar
On Wednesday, June 17, 2015 at 2:21:05 PM UTC-4, Peter Otten wrote: > Sahlusar wrote: > > > On Wednesday, June 17, 2015 at 11:00:24 AM UTC-4, Saran A wrote: > >> I would like to have this JSON object written out to a CSV file so that > >> the keys are header fields (for each of the columns) and th

Get off the list

2015-06-18 Thread Deogratius Musiige
Hi, How can i get off this mailing list? Best regards / Med venlig hilsen Deogratius Musiige Software Development Engineer Sennheiser Communications A/S Industriparken 27 DK-2750 Ballerup Direct +45 5618 0320 Mail d...@senncom.com Webwww.

Hotspot Locater

2015-06-18 Thread admin.dslcomputer
Hi everyone: There is interest in our group in the development of Python code to locate WiFi hotspots. My question: Is there a Python solution in the location of WiFi hotspots? Hal-- https://mail.python.org/mailman/listinfo/python-list