Re: JSON Object to CSV File Troubleshooting

2015-06-22 Thread Denis McMahon
On Sun, 21 Jun 2015 16:56:27 -0700, Sahlusar wrote: > Here is an example XML document that I am working with: > You are welcome to contribute and provide me with feedback. Thank you > for your continued feedback and guidance. Your XML is invalid! You have a closing MO tag with no opening tag. >

Re: How do I get the currently installed tab completion function?

2015-06-22 Thread Steven D'Aprano
On Tue, 23 Jun 2015 12:02 pm, Chris Angelico wrote: > On Tue, Jun 23, 2015 at 11:41 AM, Steven D'Aprano > wrote: >> On Tue, 23 Jun 2015 11:23 am, Chris Angelico wrote: >> >>> On Tue, Jun 23, 2015 at 11:02 AM, Steven D'Aprano >>> wrote: How do I get the currently installed completer? >>

Re: How do I get the currently installed tab completion function?

2015-06-22 Thread Chris Angelico
On Tue, Jun 23, 2015 at 11:41 AM, Steven D'Aprano wrote: > On Tue, 23 Jun 2015 11:23 am, Chris Angelico wrote: > >> On Tue, Jun 23, 2015 at 11:02 AM, Steven D'Aprano >> wrote: >>> How do I get the currently installed completer? >>> >>> Solutions for any version of Python acceptable, but if they w

Re: How do I get the currently installed tab completion function?

2015-06-22 Thread Steven D'Aprano
On Tue, 23 Jun 2015 11:23 am, Chris Angelico wrote: > On Tue, Jun 23, 2015 at 11:02 AM, Steven D'Aprano > wrote: >> How do I get the currently installed completer? >> >> Solutions for any version of Python acceptable, but if they work all the >> way back to 2.4 or older, even better. > > Whether

Re: Simplest/Idiomatic way to count files in a directory (using pathlib)

2015-06-22 Thread Paul Rubin
Travis Griggs writes: > The following seems to obtuse/clever for its own good: > return sum(1 for _ in self.path.iterdir()) I've generally done something like that. I suppose it could be added to itertools. -- https://mail.python.org/mailman/listinfo/python-list

Re: How do I get the currently installed tab completion function?

2015-06-22 Thread Chris Angelico
On Tue, Jun 23, 2015 at 11:02 AM, Steven D'Aprano wrote: > How do I get the currently installed completer? > > Solutions for any version of Python acceptable, but if they work all the way > back to 2.4 or older, even better. Whether there's a way to avoid the whole try/finally I can't say, but I

How do I get the currently installed tab completion function?

2015-06-22 Thread Steven D'Aprano
I have two (or more) different types of tab completion, and I want one to apply under certain circumstances, and the other to apply at others. For example, let's say I want one to apply inside a function which uses raw_input (or input in Python 3), and the other to apply the rest of the time. So I

Re: JSON Object to CSV File Troubleshooting

2015-06-22 Thread Chris Angelico
On Mon, Jun 22, 2015 at 9:33 AM, Denis McMahon wrote: > This is the sort of data conversion code I generally turn out in a day or > so, it's hardly rocket science as long as you have a clear description of > what is required. If you don't have a clear description of what is > required, you have to

Re: Simplest/Idiomatic way to count files in a directory (using pathlib)

2015-06-22 Thread Ian Kelly
On Mon, Jun 22, 2015 at 4:33 PM, Travis Griggs wrote: > > > Subject nearly says it all. > > If i’m using pathlib, what’s the simplest/idiomatic way to simply count how > many files are in a given directory? > > I was surprised (at first) when > >len(self.path.iterdir()) > > didn’t work. len

Re: Simplest/Idiomatic way to count files in a directory (using pathlib)

2015-06-22 Thread Travis Griggs
Subject nearly says it all. If i’m using pathlib, what’s the simplest/idiomatic way to simply count how many files are in a given directory? I was surprised (at first) when len(self.path.iterdir()) didn’t work. I don’t see anything in the .stat() object that helps me. I could of course

Simplest/Idiomatic way to count files in a directory (using pathlib)

2015-06-22 Thread Travis Griggs
Subject nearly says it all. If i’m using pathlib, what’s the simplest/idiomatic way to simply count how many files are in a given directory? I was surprised (at first) when len(self.path.iterdir()) I don’t say anything on the in the .stat() object that helps me. I could of course do the 4

Re: Calling a function is faster than not calling it?

2015-06-22 Thread Piet van Oostrum
Steven D'Aprano wrote: > Why is calling a function faster than bypassing the function object and > evaluating the code object itself? And not by a little, but by a lot? > > Here I have a file, eval_test.py: > > # === cut === > from timeit import Timer > > def func(): > a = 2 > b = 3 >

Published timeDecebal.py

2015-06-22 Thread Cecil Westerhof
I published timeDecebal.py: https://github.com/CecilWesterhof/PythonLibrary/blob/master/timeDecebal.py Not much yet: the Timer class from Steven D'Aprano and the function time_test. With this function you can get the results of a function AND the time it took to execute the function. (I find t

Re: How to check in script if Python or Jython is used

2015-06-22 Thread Dan Stromberg
IMO, it's usually better to test for features and use them if they are present, than to build a list of features available in specific interpreters. I see it as analogous to the difference between huge C #ifdef's on OS, and autoconf. On Sun, Jun 21, 2015 at 1:12 AM, Cecil Westerhof wrote: > I in

Re: Re: Pyitect - Plugin architectural system for Python 3.0+ (feedback?)

2015-06-22 Thread Ian Kelly
On Mon, Jun 22, 2015 at 2:32 AM, Ben Powers wrote: > on Tue, Jun 16, 2015 at 17:49 Ian Kelly wrote > >>On Mon, Jun 8, 2015 at 10:42 PM, Ben Powers wrote: >>> #file.py >>> from PyitectConsumes import foo >>> >>> class Bar(object): >>> def __init__(): >>> foo("it's a good day to be a

Re: what should every python expert know

2015-06-22 Thread Steven D'Aprano
On Tue, 23 Jun 2015 04:30 am, baha wrote: > I don't like to move to another programming language until being guru .. > (python is my first programming language) what are things that I must know > and discover and understand more deeply what are the projects that can be > useful for a beginner like

what should every python expert know

2015-06-22 Thread baha
I don't like to move to another programming language until being guru .. (python is my first programming language) what are things that I must know and discover and understand more deeply what are the projects that can be useful for a beginner like me and the advanced tricks -- https://mail.p

Re: CRLF problems in CPython sources

2015-06-22 Thread Rustom Mody
On Monday, June 22, 2015 at 2:53:21 PM UTC, Zachary Ware wrote: > On Monday, June 22, 2015, Rustom Mody wrote: > Trying to setup CPython repo I found some CRLF messes: > > > > 1. Some file-types that are inconsistently LF or CRLF > >    Lib/test/decimaltestdata > > > > 2. Some files that ar

Re: Opening PDF Using subprocess.Popen Failing

2015-06-22 Thread Naftali
On Friday, June 19, 2015 at 1:25:12 PM UTC-4, Naftali wrote: > It actually doesn't fail but it 'cannot open in protected mode' (see here > http://blogs.adobe.com/dmcmahon/2012/07/27/adobe-reader-cannot-open-protected-mode-due-to-a-problem-with-your-system-configuration/) > > I am using subprocess

Re: Arguments for "type metaclass" __init__ method

2015-06-22 Thread Chris Angelico
On Mon, Jun 22, 2015 at 1:17 AM, Kaviraj Kanagaraj wrote: > To dynamically create a class: > DynamicClass = type("DynamicClass", (object,), {'eggs' : 'spams'}) > > which means type's __init__ method accepts ClassName, bases(tuple) and > attrbs(dict) as args. > > > But in case of creating class via

CRLF problems in CPython sources

2015-06-22 Thread Rustom Mody
Trying to setup CPython repo I found some CRLF messes: 1. Some file-types that are inconsistently LF or CRLF Lib/test/decimaltestdata 2. Some files that are plain dirty (both LF and CRLF) Lib/venv/scripts/nt/Activate.ps1 Is this worth a bug report? Is python-dev the place for talking of su

Re: CRLF problems in CPython sources

2015-06-22 Thread Zachary Ware
On Monday, June 22, 2015, Rustom Mody wrote: > Trying to setup CPython repo I found some CRLF messes: > > 1. Some file-types that are inconsistently LF or CRLF >Lib/test/decimaltestdata > > 2. Some files that are plain dirty (both LF and CRLF) >Lib/venv/scripts/nt/Activate.ps1 > > Is this

Re: Opening PDF Using subprocess.Popen Failing

2015-06-22 Thread Naftali
On Friday, June 19, 2015 at 1:25:12 PM UTC-4, Naftali wrote: > It actually doesn't fail but it 'cannot open in protected mode' (see here > http://blogs.adobe.com/dmcmahon/2012/07/27/adobe-reader-cannot-open-protected-mode-due-to-a-problem-with-your-system-configuration/) > > I am using subprocess

Re: Opening PDF Using subprocess.Popen Failing

2015-06-22 Thread Laura Creighton
I think that your problem is that you have Protected Mode enabled. If you do, you either have to disable that, or write a policy config file. https://www.adobe.com/devnet-docs/acrobatetk/tools/AppSec/protectedmode.html says. From: Policy configuration Protected mode prevents a number of actions

Re: Opening PDF Using subprocess.Popen Failing

2015-06-22 Thread Naftali
On Friday, June 19, 2015 at 1:25:12 PM UTC-4, Naftali wrote: > It actually doesn't fail but it 'cannot open in protected mode' (see here > http://blogs.adobe.com/dmcmahon/2012/07/27/adobe-reader-cannot-open-protected-mode-due-to-a-problem-with-your-system-configuration/) > > I am using subprocess

Re: Issuing a sqilte query, picking a random result, and copying to the system clipboard

2015-06-22 Thread Tim Chase
On 2015-06-21 17:08, John T. Haggerty wrote: > I'm looking to just have a simple program that will do a SQLite > query pull a random record and then copy that record too the > clipboard the system. I'm not quite seeing how to do this perhaps > this is already been done elsewhere but I spent quite a

Re: rl_config

2015-06-22 Thread Robin Becker
On 22/06/2015 13:03, Robin Becker wrote: Anyone wishing to bend their minds around instance as module can see the code I've tested on //annapurna/tmp/rl_config.py. whoops misposted sorry -- Robin Becker -- https://mail.python.org/mailman/listinfo/python-list

rl_config

2015-06-22 Thread Robin Becker
Anyone wishing to bend their minds around instance as module can see the code I've tested on //annapurna/tmp/rl_config.py. -- Robin Becker -- https://mail.python.org/mailman/listinfo/python-list

Re: Opening PDF Using subprocess.Popen Failing

2015-06-22 Thread Robin Becker
On 22/06/2015 11:33, Robin Becker wrote: . Naftali, I ran the following from python prompt for what it's worth this also works on my machine Windows PowerShell Copyright (C) 2009 Microsoft Corporation. All rights reserved. PS C:\Users\rptlab> cd tmp PS C:\Users\rptlab\tm

Re: Opening PDF Using subprocess.Popen Failing

2015-06-22 Thread Robin Becker
. Naftali, I ran the following from python prompt import os os.system('"C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe" /n thello.pdf') and this worked as did import subprocess subprocess.Popen(['C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe','/n','thello

Re: instance as module

2015-06-22 Thread Robin Becker
On 20/06/2015 08:24, Steven D'Aprano wrote: On Fri, 19 Jun 2015 07:29 pm, Robin Becker wrote: I'm trying to overcome a recursive import issue in reportlab. .. I'm afraid I don't understand what you are trying to say here. Why can't the user just set up "such a default" e.g. canvas_ba

EuroPython 2015: Partner program deadline extended

2015-06-22 Thread M.-A. Lemburg
We have negotiated an extension of the deadline to register for the partner program tours with the local tour operator. *** EuroPython 2015 Partner Program *** https://ep2015.europython.eu/en/events/partner-program/ There is plenty to see in and around Bilbao. We have worked

Re: Re: Pyitect - Plugin architectural system for Python 3.0+ (feedback?)

2015-06-22 Thread Ben Powers
on Tue, Jun 16, 2015 at 17:49 Ian Kelly wrote >On Mon, Jun 8, 2015 at 10:42 PM, Ben Powers wrote: >> As importlib has been added in python 3 and up I decided to use it's >> abilities to create a plugin system for truly modular development in python. >> >> Pyitect has the ability to drop in comp

Arguments for "type metaclass" __init__ method

2015-06-22 Thread Kaviraj Kanagaraj
Hi All, I was reading about meta programming in "Pro Django" book. I came across the "type" class which will be acting as default meta class for all other class. Also "type" metaclass is where actuall class object is created To dynamically create a class: DynamicClass = type("DynamicClass", (obj

Re: Do I need license to release the Python version of old BASIC games?

2015-06-22 Thread Laura Creighton
In a message of Sun, 21 Jun 2015 22:23:54 -0600, Michael Torrie writes: >>From some brief research, it appears there is some question about the >ability to declare something to be in the public domain, but it is by no >means a sure thing and lots of people feel it's just fine to declare >something

[no subject]

2015-06-22 Thread John T. Haggerty
I'm looking to just have a simple program that will do a SQLite query pull a random record and then copy that record too the clipboard the system. I'm not quite seeing how to do this perhaps this is already been done elsewhere but I spent quite a bit of time trying to figure out how to do that and