Re: JSON Object to CSV Question

2015-06-19 Thread Saran Ahluwalia
My answers are below in red. On Fri, Jun 19, 2015 at 2:47 PM, Joonas Liik wrote: > > You say you are taking this from an xml file and want to get a CSV file.. > > Why are you making an intermediate JSON file? > I thought that this would be the most efficient method as it emulates Python diction

Re: instance as module

2015-06-19 Thread dieter
Robin Becker writes: > I'm trying to overcome a recursive import issue in reportlab. > ... sketched solution ... In the "zope" project, the same problem was approached in a slightly different way -- see the product "zope.deferredimport". It allows to defer an actual import for an imported name u

Relation: a new standard (PEP) container?

2015-06-19 Thread Scott
We've been using a simple container implementation of a mathematical relation (https://simple.wikipedia.org/wiki/Relation_(mathematics)) (i.e. an invertible M:M mapping) for some time. We've been waiting for many years (decades actually) to have this concept incorporated as a standard container

[no subject]

2015-06-19 Thread Scott
We've been using a simple container implementation of a mathematical relation (https://simple.wikipedia.org/wiki/Relation_(mathematics)) (i.e. an invertible M:M mapping) for some time. We've been waiting for many years (decades actually) to have this concept incorporated as a standard container

Re: JSON Object to CSV Question

2015-06-19 Thread Saran Ahluwalia
@Joonas: The previous example was a typo. Please use the below example as a case study. 1. {'D_B': ['0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'], 2. 'F_Int32': ['0', 3. '0', 4. '0', 5. '0', 6. '0', 7. '0', 8. '0', 9. '0', 10. '0', 11. '0', 12. '0',

Re: Catching exceptions with multi-processing

2015-06-19 Thread Cameron Simpson
On 19Jun2015 18:16, Fabien wrote: On 06/19/2015 04:25 PM, Andres Riancho wrote: My recommendation is that you should pass some extra arguments to the task: * A unique task id * A result multiprocessing.Queue When an exception is raised you put (unique_id, exception) to the queue

Re: instance as module

2015-06-19 Thread Ben Finney
Robin Becker writes: > For the specific case of the canvas_basefontname I don't actually need > to do anything specific since it is just a string The configuration values should be nothing but immutable values: strings, integers, booleans. Possibly collections of those. You seem to be implying

Re: Catching exceptions with multi-processing

2015-06-19 Thread Chris Angelico
On Sat, Jun 20, 2015 at 1:41 AM, Steven D'Aprano wrote: > On Sat, 20 Jun 2015 12:01 am, Fabien wrote: > >> Folks, >> >> I am developing a tool which works on individual entities (glaciers) and >> do a lot of operations on them. There are many tasks to do, one after >> each other, and each task fol

Re: JSON Object to CSV Question

2015-06-19 Thread Joonas Liik
this.. might not throw an eror, but you have 2 keys with the same name "F", and 1 of them will probably be disgarded..., you have data corruption even before you try to process it. { "F": "False", "F": { "Int32": ["0", "0", "0"] }, } you mentioned Excel at one point. perhaps you could mock up w

ANN: Wing IDE 5.1.5 released

2015-06-19 Thread Wingware
Hi, Wingware has released version 5.1.5 of Wing IDE, our cross-platform integrated development environment for the Python programming language. Wing IDE features a professional code editor with vi, emacs, visual studio, and other key bindings, auto-completion, call tips, context-sensitive au

Re: Opening PDF Using subprocess.Popen Failing

2015-06-19 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: JSON Object to CSV Question

2015-06-19 Thread Joonas Liik
You say you are taking this from an xml file and want to get a CSV file.. Why are you making an intermediate JSON file? Why do you need the CSV output? Could you perhaps be better off using another format? Your data seems to be a quite deeply nested hierarchical structure and doesn't seem to su

Re: Opening PDF Using subprocess.Popen Failing

2015-06-19 Thread Laura Creighton
In a message of Fri, 19 Jun 2015 10:24:56 -0700, Naftali writes: >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

Opening PDF Using subprocess.Popen Failing

2015-06-19 Thread Naftali
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.Popen("AcroRe32.exe /n ") which is the actuall adobe reader command

Re: Catching exceptions with multi-processing

2015-06-19 Thread Fabien
On 06/19/2015 04:25 PM, Andres Riancho wrote: Fabien, My recommendation is that you should pass some extra arguments to the task: * A unique task id * A result multiprocessing.Queue When an exception is raised you put (unique_id, exception) to the queue. When it succeeds you

Re: Catching exceptions with multi-processing

2015-06-19 Thread Fabien
On 06/19/2015 05:41 PM, Steven D'Aprano wrote: On Sat, 20 Jun 2015 12:01 am, Fabien wrote: >Folks, > >I am developing a tool which works on individual entities (glaciers) and >do a lot of operations on them. There are many tasks to do, one after >each other, and each task follows the same inter

Re: JSON Object to CSV Question

2015-06-19 Thread Saran Ahluwalia
Hi Steven, Okay, I understand now how convoluted this sounds. Here is a more focused issue (I hope) referencing the following sample JSON object within a file: 1. "PAC": { 2. "Account": [{ 3. "PC": "0", 4. "CMC": "0", 5. "WC": "0", 6. "DLA": "0", 7. "CN": null, 8. "FC": {

Re: Catching exceptions with multi-processing

2015-06-19 Thread Steven D'Aprano
On Sat, 20 Jun 2015 12:01 am, Fabien wrote: > Folks, > > I am developing a tool which works on individual entities (glaciers) and > do a lot of operations on them. There are many tasks to do, one after > each other, and each task follows the same interface: I'm afraid your description is contrad

Re: Catching exceptions with multi-processing

2015-06-19 Thread Jean-Michel Pichavant
- Original Message - > From: "Oscar Benjamin" > A simple way to approach this could be something like: > > #!/usr/bin/env python3 > > import math > import multiprocessing > > def sqrt(x): > if x < 0: > return 'error', x > else: > return 'success', math.sqrt(x) >

Re: Catching exceptions with multi-processing

2015-06-19 Thread Oscar Benjamin
On 19 June 2015 at 15:01, Fabien wrote: > Folks, > > I am developing a tool which works on individual entities (glaciers) and do > a lot of operations on them. There are many tasks to do, one after each > other, and each task follows the same interface: > > def task_1(path_to_glacier_dir): > o

Re: JSON Object to CSV Question

2015-06-19 Thread Steven D'Aprano
On Fri, 19 Jun 2015 07:50 pm, Saran Ahluwalia wrote: > If you read the most recent thread that I just posted it states far more > information The problem is, you are posting *too much* of the *wrong* information. The exception you are getting appears to be a simple one: you are getting the excep

Re: Catching exceptions with multi-processing

2015-06-19 Thread Jean-Michel Pichavant
- Original Message - > From: "Fabien" > To: python-list@python.org > Sent: Friday, 19 June, 2015 4:01:02 PM > Subject: Catching exceptions with multi-processing > > Folks, > > I am developing a tool which works on individual entities (glaciers) > and > do a lot of operations on them. The

Re: Catching exceptions with multi-processing

2015-06-19 Thread Andres Riancho
Fabien, My recommendation is that you should pass some extra arguments to the task: * A unique task id * A result multiprocessing.Queue When an exception is raised you put (unique_id, exception) to the queue. When it succeeds you put (unique_id, None). In the main process you consu

ANN: eGenix Talks & Videos: Python Keynote and Application Design Talk

2015-06-19 Thread eGenix Team: M.-A. Lemburg
ANNOUNCING eGenix Talks & Videos: Python Keynote and Application Design Talk PyWaw Summit 2015 This announcement is also available on our web-site for online

Catching exceptions with multi-processing

2015-06-19 Thread Fabien
Folks, I am developing a tool which works on individual entities (glaciers) and do a lot of operations on them. There are many tasks to do, one after each other, and each task follows the same interface: def task_1(path_to_glacier_dir): open file1 in path_to_glacier_dir do stuff i

Re: JSON Object to CSV Question

2015-06-19 Thread Sahlusar
On Friday, June 19, 2015 at 8:47:25 AM UTC-4, Sahlusar wrote: > On Friday, June 19, 2015 at 6:16:40 AM UTC-4, Cecil Westerhof wrote: > > Top posting is frowned upon. Could you put your reply under where you > > reply on next time? > > > > On Friday 19 Jun 2015 11:50 CEST, Saran Ahluwalia wrote: >

Re: JSON Object to CSV Question

2015-06-19 Thread Sahlusar
On Friday, June 19, 2015 at 6:16:40 AM UTC-4, Cecil Westerhof wrote: > Top posting is frowned upon. Could you put your reply under where you > reply on next time? > > On Friday 19 Jun 2015 11:50 CEST, Saran Ahluwalia wrote: > > > No I am not a troll. I am attempting to clarify an evolving problem

Re: instance as module

2015-06-19 Thread Robin Becker
On 19/06/2015 11:23, Peter Otten wrote: Robin Becker wrote: . Do I understand this correctly? You got bitten by a complex setup and now you are hoping to improve the situation by making it even more complex? How about reordering initialisation in such a way that the user defaults are

Re: JSON Object to CSV Question

2015-06-19 Thread Saran Ahluwalia
Thank you for clarifying. I will be more cognizant to follow this protocol. Sent from my iPhone > On Jun 19, 2015, at 6:07 AM, Cecil Westerhof wrote: > > Top posting is frowned upon. Could you put your reply under where you > reply on next time? > >> On Friday 19 Jun 2015 11:50 CEST, Saran Ah

Re: instance as module

2015-06-19 Thread Peter Otten
Robin Becker wrote: > I'm trying to overcome a recursive import issue in reportlab. > > Module reportlab.rl_config uses various sources (eg ~/.reportlab_settings) > to initialize various defaults eg canvas_basefontname. If a user wants to > utilize reportlab to set up such a default, it's not pos

Re: JSON Object to CSV Question

2015-06-19 Thread Cecil Westerhof
Top posting is frowned upon. Could you put your reply under where you reply on next time? On Friday 19 Jun 2015 11:50 CEST, Saran Ahluwalia wrote: > No I am not a troll. I am attempting to clarify an evolving problem. > If you read the most recent thread that I just posted it states far > more in

Re: ctypes and byte order

2015-06-19 Thread Jean-Michel Pichavant
- Original Message - > From: "Terry Reedy" > To: python-list@python.org > Sent: Thursday, 18 June, 2015 7:02:16 PM > Subject: Re: ctypes and byte order > > On 6/18/2015 5:39 AM, Jean-Michel Pichavant wrote: > > > I'm currently writing python code that writes a small binary file > > to >

Re: JSON Object to CSV Question

2015-06-19 Thread Saran Ahluwalia
Steve, No I am not a troll. I am attempting to clarify an evolving problem. If you read the most recent thread that I just posted it states far more information - in my humble opinion. Peter was of great assistance. The data becomes more convoluted; as a fairly new programmer I am looking for

instance as module

2015-06-19 Thread Robin Becker
I'm trying to overcome a recursive import issue in reportlab. Module reportlab.rl_config uses various sources (eg ~/.reportlab_settings) to initialize various defaults eg canvas_basefontname. If a user wants to utilize reportlab to set up such a default, it's not possible to do so in the settin

[Solved] Python.exe has stopped working

2015-06-19 Thread Alexis Dubois
Le samedi 6 juin 2015 13:40:13 UTC+2, Laura Creighton a écrit : > In a message of Fri, 05 Jun 2015 11:15:31 +0200, Christian Gollwitzer writes: > >Am 05.06.15 um 11:03 schrieb Alexis Dubois: > >> Anyone else for an idea on that? > >> > >Well, it is a crash on exit. Looks like a memory error inside