[New-bugs-announce] [issue31467] cElementTree behaves differently compared to ElementTree

Ravikumar report at bugs.python.org
Thu Sep 14 06:06:21 EDT 2017

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()


/tmp/Python$ cat country_data.xml 
<?xml version="1.0"?>
    <country name="Liechtenstein">
        <neighbor name="Austria" direction="E"/>
        <neighbor name="Switzerland" direction="W"/>


/tmp/Python$ python testxml.py 
Traceback (most recent call last):
  File "testxml.py", line 10, in <module>
  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 <report at bugs.python.org>

More information about the New-bugs-announce mailing list