Opened 6 years ago

Closed 6 years ago

#6576 closed (invalid)

lxml.etree.tostring crashes after importing django.contrib.gis.db.models

Reported by: kanu@… Owned by: nobody
Component: GIS Version: master
Severity: Keywords: lxml
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


I know that sounds strange, but under the following conditions my python shell ends with a bus-errer:

  • MacBookPro
  • Mac OSX 10.5 - Leopard
  • Python 2.5
  • psycopg2, lxml2.0


from django.contrib.gis.db import models

in the terminal

...$python shell
Python 2.5.1 (r251:54869, Apr 18 2007, 22:08:04) 
[GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from lxml import etree
>>> etree.tostring(etree.Element('TEST'))
Bus error

the only way to get this work is passing the unicode object as encoding keyword

>>> etree.tostring(etree.Element('TEST'),encoding=unicode)

Attachments (0)

Change History (1)

comment:1 Changed 6 years ago by jbronn

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

I'm pretty sure this is lxml, and not GeoDjango related. I reproduced the bug; however I also reproduced it independently of any Django/GeoDjango installation. I use IPython, and I repeated the bug as follows:

(1) Invoke IPython, independently of Django/GeoDjango:

$ ipython

(2) Bug reproduced as follows

In [1]: from lxml import etree

In [2]: etree.tostring(etree.Element('TEST'))
Bus error

My guess is that IPython and Django both set up something unicode-wise that lxml doesn't like (remember lxml 2.0 is still in 'beta'). Thus, I'm marking this as invalid unless there I'm presented with some concrete evidence to the contrary.

Add Comment

Modify Ticket

Change Properties
<Author field>
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.