Re: Understanding " 'xml.etree.ElementTree.Element' does not support the buffer interface"

2016-01-11 Thread Saran Ahluwalia
Hi Steven: Just as an update - apparently there were bytes in the Windows Command Terminal that were interrupting the process execution. I didn't realize this was happening until I dug around Windows' Q forum. Cheers On Sun, Jan 10, 2016 at 12:53 PM, Saran Ahluwalia < ahlusar.ahl

Re: Understanding " 'xml.etree.ElementTree.Element' does not support the buffer interface"

2016-01-10 Thread Saran Ahluwalia
Hi Steven: That is the only message (*xml.etree.ElementTree.Element' does not support the buffer interface"*). There is no traceback. My apologies for not clarifying previously. On Sun, Jan 10, 2016 at 10:19 AM, Steven D'Aprano wrote: > On Mon, 11 Jan 2016 02:04 am, kbtyo

Re: Understanding " 'xml.etree.ElementTree.Element' does not support the buffer interface"

2016-01-10 Thread Saran Ahluwalia
Hi Steven: The previous code was a stand along under the " if __name__ == '__main__': ". The full function suite that I have made (and indeed includes a try and except block): import os.path import sys import csv from io import StringIO import xml.etree.cElementTree as ElementTree from

Re: Understanding how to quote XML string in order to serialize using Python's ElementTree

2016-01-09 Thread Saran Ahluwalia
As mentioned previously, I assigned the variable *data *to the string ''',0001,0070,". When any utility that attempts to parse this string (this is one example of millions found in my actual data source) you receive that error. You would need to comment out the following: data =

Re: Understanding how to quote XML string in order to serialize using Python's ElementTree

2016-01-09 Thread Saran Ahluwalia
Thank you for the feedback on this. I believe that the excel dialect includes just that: class excel(Dialect): delimiter = ',' quotechar = '"' doublequote = True skipinitialspace = False lineterminator = '\r\n' quoting = QUOTE_MINIMAL On Sat, Jan 9, 2016 at 5:23 PM,

Re: AttributeError: 'module' object has no attribute '__path__'

2015-08-31 Thread Saran Ahluwalia
Laura, It does not appear to be the case. I actually had to actually unset the PYTHONPATH. Thanks for your suggestion. Sincerely, Saran On Mon, Aug 31, 2015 at 4:17 PM, Laura Creighton wrote: > Check and see if you have a file in your working directory with the > very same

Re: GOTCHA with list comprehension

2015-08-07 Thread Saran Ahluwalia
@ChrisA You, my friend, certainly put the nail in the coffin! Sent from my iPhone On Aug 5, 2015, at 5:52 AM, Chris Angelico ros...@gmail.com wrote: On Wed, Aug 5, 2015 at 7:01 PM, Marko Rauhamaa ma...@pacujo.net wrote: Chris Angelico ros...@gmail.com: You can chain 'for' and 'if' clauses

Re: lxml.xpath 'for/xpath' to get to a node and then xpath again within the loop?

2015-07-02 Thread Saran Ahluwalia
So what did you do to resolve this? Please provide your fix. This is an excellent case study for others. Sent from my iPhone On Jul 2, 2015, at 5:34 AM, Veek M vek.m1...@gmail.com wrote: never mind fixed.. it's returning a list so whatever[0].text and relative-path for the xpath

Re: To write headers once with different values in separate row in CSV

2015-06-23 Thread Saran Ahluwalia
It was an XML formatting issue; apparently you have to explicitly call a delimiter via the Command Prompt on my OS. IPython Notebook seems to make certain assumptions regarding read and write. On Tue, Jun 23, 2015 at 3:12 PM, John Gordon gor...@panix.com wrote: In

Re: JSON Object to CSV Question

2015-06-20 Thread Saran Ahluwalia
My answers are below in red. On Fri, Jun 19, 2015 at 2:47 PM, Joonas Liik liik.joo...@gmail.com 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

Re: JSON Object to CSV Question

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

2015-06-20 Thread Saran Ahluwalia
Here is the dictionary that corresponds with the CSV printed to the console: 1. { 2. PAC: { 3. Account: [{ 4. PC: 0, 5. CMC: 0, 6. WC: 0, 7. DLA: 0, 8. CN: null, 9. FC: { 10. Int32: [0, 11. 0, 12. 0, 13. 0, 14. 0] 15. }, 16. F: { 17.

Re: JSON Object to CSV Question

2015-06-19 Thread Saran Ahluwalia
2015 17:49:35 -0400, Saran Ahluwalia ahlusar.ahluwa...@gmail.com 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

Re: JSON Object to CSV Question

2015-06-19 Thread Saran Ahluwalia
, 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 information - in my humble opinion. Peter was of great You should put more thought about how your postings will look

Re: JSON Object to CSV Question

2015-06-19 Thread Saran Ahluwalia
(as described above). Thank you for your guidance. On Fri, Jun 19, 2015 at 10:47 AM, Steven D'Aprano st...@pearwood.info wrote: 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

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

Addendum to Strategy/ Advice for How to Best Attack this Problem?

2015-03-29 Thread Saran Ahluwalia
On Sunday, March 29, 2015 at 7:33:04 AM UTC-4, Saran Ahluwalia wrote: Below are the function's requirements. I am torn between using the OS module or some other quick and dirty module. In addition, my ideal assumption that this could be cross-platform. Records refers to contents in a file

Second Pair of eyes for Correctly writing out XML from DataFrame (Pandas)?

2015-03-29 Thread Saran Ahluwalia
I would appreciate feedback on whether I correctly exported my DataFrame and wrote into XML. I used the ElementTree library. My DataFrame has 11 rows and 8 columns (excluding the index column) For your convenience here it is: #My schema assumption: #list #[message #indexSome

Strategy/ Advice for How to Best Attack this Problem?

2015-03-29 Thread Saran Ahluwalia
Below are the function's requirements. I am torn between using the OS module or some other quick and dirty module. In addition, my ideal assumption that this could be cross-platform. Records refers to contents in a file. What are some suggestions from the Pythonistas? * Monitors a folder for