{"action":"created","issue":{"url":"https://api.github.com/repos/toastdriven/pysolr/issues/72","labels_url":"https://api.github.com/repos/toastdriven/pysolr/issues/72/labels{/name}","comments_url":"https://api.github.com/repos/toastdriven/pysolr/issues/72/comments","events_url":"https://api.github.com/repos/toastdriven/pysolr/issues/72/events","html_url":"https://github.com/toastdriven/pysolr/issues/72","id":11351602,"number":72,"title":"TypeError: Element() keywords must be strings","user":{"login":"srusskih","id":340727,"avatar_url":"https://avatars.githubusercontent.com/u/340727?v=3","gravatar_id":"","url":"https://api.github.com/users/srusskih","html_url":"https://github.com/srusskih","followers_url":"https://api.github.com/users/srusskih/followers","following_url":"https://api.github.com/users/srusskih/following{/other_user}","gists_url":"https://api.github.com/users/srusskih/gists{/gist_id}","starred_url":"https://api.github.com/users/srusskih/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srusskih/subscriptions","organizations_url":"https://api.github.com/users/srusskih/orgs","repos_url":"https://api.github.com/users/srusskih/repos","events_url":"https://api.github.com/users/srusskih/events{/privacy}","received_events_url":"https://api.github.com/users/srusskih/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":18,"created_at":"2013-02-25T09:18:49Z","updated_at":"2015-03-09T14:24:24Z","closed_at":"2013-02-26T11:40:42Z","body":"```\r\nTraceback (most recent call last):\r\n  File \"/storage/pydev/feelfree-v4/feelfree/../lib/haystack/management/commands/update_index.py\", line 210, in handle_\r\nlabel\r\n    self.update_backend(label, using)\r\n  File \"/storage/pydev/feelfree-v4/feelfree/../lib/haystack/management/commands/update_index.py\", line 256, in update_\r\nbackend\r\n    do_update(backend, index, qs, start, end, total, self.verbosity)\r\n  File \"/storage/pydev/feelfree-v4/feelfree/../lib/haystack/management/commands/update_index.py\", line 78, in do_updat\r\ne\r\n    backend.update(index, current_qs)\r\n  File \"/storage/pydev/feelfree-v4/feelfree/../lib/haystack/backends/solr_backend.py\", line 66, in update\r\n    self.conn.add(docs, commit=commit, boost=index.get_field_weights())\r\n  File \"/storage/pydev/feelfree-v4/feelfree/../lib/pysolr.py\", line 740, in add\r\n    message.append(self._build_doc(doc, boost=boost))\r\n  File \"/storage/pydev/feelfree-v4/feelfree/../lib/pysolr.py\", line 695, in _build_doc\r\n    field = ET.Element('field', **attrs)\r\n  File \"lxml.etree.pyx\", line 2560, in lxml.etree.Element (src/lxml/lxml.etree.c:52924)\r\nTypeError: Element() keywords must be strings\r\n```\r\n\r\nattrs looks like `{u'name': 'django_ct'}`\r\n\r\n\r\n**env:**\r\n * Linux 3.5.0-22-generic #34-Ubuntu SMP Tue Jan 8 21:47:00 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux\r\n * python 2.7.3\r\n * pysolr 3.0.5\r\n * lxml 2.3.5\r\n\r\n\r\nPossible fix (works for me)\r\n\r\n``` diff\r\n@@ -687,10 +687,10 @@ class Solr(object):\r\n                 if self._is_null_value(bit):\r\n                     continue\r\n \r\n-                attrs = {'name': key}\r\n+                attrs = {str('name'): key}\r\n \r\n                 if boost and key in boost:\r\n-                    attrs['boost'] = force_unicode(boost[key])\r\n+                    attrs[str('boost')] = force_unicode(boost[key])\r\n \r\n                 field = ET.Element('field', **attrs)\r\n                 field.text = self._from_python(bit)\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/toastdriven/pysolr/issues/comments/77862229","html_url":"https://github.com/toastdriven/pysolr/issues/72#issuecomment-77862229","issue_url":"https://api.github.com/repos/toastdriven/pysolr/issues/72","id":77862229,"user":{"login":"acdha","id":46565,"avatar_url":"https://avatars.githubusercontent.com/u/46565?v=3","gravatar_id":"","url":"https://api.github.com/users/acdha","html_url":"https://github.com/acdha","followers_url":"https://api.github.com/users/acdha/followers","following_url":"https://api.github.com/users/acdha/following{/other_user}","gists_url":"https://api.github.com/users/acdha/gists{/gist_id}","starred_url":"https://api.github.com/users/acdha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acdha/subscriptions","organizations_url":"https://api.github.com/users/acdha/orgs","repos_url":"https://api.github.com/users/acdha/repos","events_url":"https://api.github.com/users/acdha/events{/privacy}","received_events_url":"https://api.github.com/users/acdha/received_events","type":"User","site_admin":false},"created_at":"2015-03-09T14:24:24Z","updated_at":"2015-03-09T14:24:24Z","body":"@tisto The problem was that people had other versions of lxml in their projects & it'd conflict for something which is only relevant to a subset of users. My preferred approach is the one from https://github.com/toastdriven/pysolr/pull/133#issuecomment-60452949 where we simply drop lxml entirely since it's only used for error handling. I just wrapped that code into #149 for easier testing / commenting."}}