New submission from Ravikumar:

I have started learning python and I see below snippet fails. I do not 
understand how to fix the issue and assume this might be a bug in 
multiprocessing library.

I use Python 2.7.12


My python snippet

import xml.etree.ElementTree as ET    # WORKS
import xml.etree.cElementTree as ET    # DOES NOT WORK
import multiprocessing

tree = ET.parse('country_data.xml')
root = tree.getroot()

manager = multiprocessing.Manager()
elems_saved = manager.dict()

elems_saved["1"]=root


/tmp/Python$ cat country_data.xml 
<?xml version="1.0"?>
<data>
    <country name="Liechtenstein">
        <rank>1</rank>
        <year>2008</year>
        <gdppc>141100</gdppc>
        <neighbor name="Austria" direction="E"/>
        <neighbor name="Switzerland" direction="W"/>
    </country>
</data>
/tmp/Python$


OUTPUT

/tmp/Python$ python testxml.py 
Traceback (most recent call last):
  File "testxml.py", line 10, in <module>
    elems_saved["1"]=root
  File "<string>", line 2, in __setitem__
  File "/usr/lib/python2.7/multiprocessing/managers.py", line 758, in 
_callmethod
    conn.send((self._id, methodname, args, kwds))
TypeError: expected string or Unicode object, NoneType found

Please let me know if I am wrong

----------
components: Library (Lib), XML
messages: 302164
nosy: poojariravi
priority: normal
severity: normal
status: open
title: cElementTree behaves differently compared to ElementTree
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue31467>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to