Opened 17 years ago

Closed 17 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: dev
Severity: Keywords: lxml
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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

/.../models.py

from django.contrib.gis.db import models

in the terminal

...$python manage.py 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.
(InteractiveConsole)
>>> 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)

Change History (1)

comment:1 by jbronn, 17 years ago

Resolution: invalid
Status: newclosed

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.

Note: See TracTickets for help on using tickets.
Back to Top