Several effects broken with python error 'invalid tag name'

Bug #179770 reported by Tom Davidson
20
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Medium
Aaron C Spike

Bug Description

Currently (SVN rev 16895, 12/31/07, linux x86), a number of effects are broken, all returning a similar error: Lorem Ipsum, Gear, Barcode, and LaTeX formula. A number of other bugs have been filed for the individual extensions, but this looks suspiciously like a single shared problem. The python tracebacks are as follows:

Render->LaTeX formula:

Traceback (most recent call last):
  File "/usr/local/share/inkscape/extensions/eqtexsvg.py", line 119, in ?
    e.affect()
  File "/usr/local/share/inkscape/extensions/inkex.py", line 153, in affect
    self.effect()
  File "/usr/local/share/inkscape/extensions/eqtexsvg.py", line 114, in effect
    svg_open(self, svg_file)
  File "/usr/local/share/inkscape/extensions/eqtexsvg.py", line 69, in svg_open
    group = clone_and_rewrite(self, svg)
  File "/usr/local/share/inkscape/extensions/eqtexsvg.py", line 53, in clone_and_rewrite
    node_out = inkex.etree.Element(inkex.addNS(node_in.tag,'svg'))
  File "etree.pyx", line 1801, in etree.Element
  File "apihelpers.pxi", line 101, in etree._makeElement
  File "apihelpers.pxi", line 712, in etree._getNsTag
ValueError: Invalid tag name

Render->Barcode (note you have to enter the correct # of digits to trigger this)

pstoedit: version 3.44 / DLL interface 108 (build Nov 23 2006 - release build - g++ 4.1.1 20061011 (Red Hat 4.1.1-30)) : Copyright (C) 1993 - 2006 Wolfgang Glunz
Traceback (most recent call last):
  File "/usr/local/share/inkscape/extensions/eqtexsvg.py", line 119, in ?
    e.affect()
  File "/usr/local/share/inkscape/extensions/inkex.py", line 153, in affect
    self.effect()
  File "/usr/local/share/inkscape/extensions/eqtexsvg.py", line 114, in effect
    svg_open(self, svg_file)
  File "/usr/local/share/inkscape/extensions/eqtexsvg.py", line 69, in svg_open
    group = clone_and_rewrite(self, svg)
  File "/usr/local/share/inkscape/extensions/eqtexsvg.py", line 53, in clone_and_rewrite
    node_out = inkex.etree.Element(inkex.addNS(node_in.tag,'svg'))
  File "etree.pyx", line 1801, in etree.Element
  File "apihelpers.pxi", line 101, in etree._makeElement
  File "apihelpers.pxi", line 712, in etree._getNsTag
ValueError: Invalid tag name

Render->Lorem Ipsum

Traceback (most recent call last):
  File "/usr/local/share/inkscape/extensions/lorem_ipsum.py", line 232, in ?
    e.affect()
  File "/usr/local/share/inkscape/extensions/inkex.py", line 153, in affect
    self.effect()
  File "/usr/local/share/inkscape/extensions/lorem_ipsum.py", line 224, in effect
    g=inkex.etree.SubElement(svg,inkex.addNS('g','svg'),gattribs)
  File "etree.pyx", line 1854, in etree.SubElement
  File "apihelpers.pxi", line 145, in etree._initNodeAttributes
  File "apihelpers.pxi", line 723, in etree._getNsTag
ValueError: Invalid tag name

Render->Gear

Traceback (most recent call last):
  File "/usr/local/share/inkscape/extensions/gears.py", line 162, in ?
    e.affect()
  File "/usr/local/share/inkscape/extensions/inkex.py", line 153, in affect
    self.effect()
  File "/usr/local/share/inkscape/extensions/gears.py", line 154, in effect
    g = inkex.etree.SubElement(self.current_layer, 'g', g_attribs)
  File "etree.pyx", line 1854, in etree.SubElement
  File "apihelpers.pxi", line 145, in etree._initNodeAttributes
  File "apihelpers.pxi", line 723, in etree._getNsTag
ValueError: Invalid tag name

Revision history for this message
Tom Davidson (tjd-mit) wrote :

I guess this could have something to do with my version of lxml (python-lxml-1.3.3-1.fc6). But in any case I was able to build against what I have, so either the problem should be fixed, or the dependencies should be updated...
Here is some more info on my installation of lxml:

% rpmquery -i python-lxml

Name : python-lxml Relocations: (not relocatable)
Version : 1.3.3 Vendor: Fedora Project
Release : 1.fc6 Build Date: Tue 31 Jul 2007 04:44:57 AM PDT
Install Date: Sun 04 Nov 2007 06:57:42 PM PST Build Host: xenbuilder2.fedora.redhat.com
Group : Development/Libraries Source RPM: python-lxml-1.3.3-1.fc6.src.rpm
Size : 5480328 License: BSD
Packager : Fedora Project <http://bugzilla.redhat.com/bugzilla>
URL : http://codespeak.net/lxml/
Summary : ElementTree-like Python bindings for libxml2 and libxslt
Description :
lxml provides a Python binding to the libxslt and libxml2 libraries. It
follows the ElementTree API as much as possible in order to provide a more
Pythonic interface to libxml2 and libxslt than the default bindings. In
particular, lxml deals with Python Unicode strings rather than encoded UTF-8
and handles memory management automatically, unlike the default bindings.

Changed in inkscape:
assignee: nobody → acspike
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Aaron C Spike (acspike) wrote :

I don't quite understand "But in any case I was able to build against what I have, so either the problem should be fixed, or the dependencies should be updated...". The python extensions don't affect building Inkscape. They are "built" dynamically by python when they are executed. On windows we currently ship with a beta of lxml 1.3.

Revision history for this message
Aaron C Spike (acspike) wrote :

lxml 1.3.3 does exhibit the same problem on win32. lxml 1.3.6 reports the following message on failure:

share\extensions\gears.py:154: TagNameWarning: Tag names must not contain ':', lxml 2.0 will enforce well-formed tag names as required by the XML specification.

  g = inkex.etree.SubElement(self.current_layer, 'g', g_attribs)

share\extensions\gears.py:159: TagNameWarning: Tag names must not contain ':', lxml 2.0 will enforce well-formed tag names as required by the XML specification.

  gear = inkex.etree.SubElement(g, 'svg:path', gear_attribs )

Revision history for this message
Aaron C Spike (acspike) wrote :

Yes indeed.

from http://codespeak.net/lxml/changes-1.3.5.html:

Bugs fixed 1.3.3
    * Element() did not raise an exception on tag names containing ':'

Other changes in 1.3.4
    * lxml now raises a TagNameWarning about tag names containing ':' instead of an Error as 1.3.3 did. The reason is that a number of projects currently misuse the previous lack of tag name validation to generate namespace prefixes without declaring namespaces. Apart from the danger of generating broken XML this way, it also breaks most of the namespace-aware tools in XML, including XPath, XSLT and validation. lxml 1.3.x will continue to support this bug with a Warning, while lxml 2.0 will be strict about well-formed tag names (not only regarding ':').

Revision history for this message
Aaron C Spike (acspike) wrote :

There appears to be one bad tag name in our code in gears.py which needs to be fixed ("svg:path" is indeed invalid). The other errors however seem to display a bug in lxml because it is reporting an error for proper ElementTree styled tags with ns info such as "{http://www.w3.org/2000/svg}g". The ":" in the namespace URI is necessary and shouldn't generate an error. The warnings generated by lxml 1.3.4 and greater are annoying but non-fatal. lxml 1.3.3 raises an exception. I know of no work around for this unless lxml has introduced some sort of alternative syntax. We can't work with lxml 1.3.3 and it seems lxml 1.3.4 and greater still need to be fixed.

Revision history for this message
Tom Davidson (tjd-mit) wrote :

Here is a relevant thread from the lxml-dev mailing list.
http://thread.gmane.org/gmane.comp.python.lxml.devel/2831

I'm not sure if they're aware of the bug Aaron has identified. They use launchpad for bug tracking, so this would be a nice opportunity to use some of that nifty cross-project mojo, but right now their tracker only seems to have one bug in it under 'all bugs' ???

Revision history for this message
Aaron C Spike (acspike) wrote :

What do we do about Fedora Core 6 having a fatally broken version?

Revision history for this message
Aaron C Spike (acspike) wrote :

Ok. My mistake. "Invalid tag name" refers to attribute names as well. This is our problem. We can fix this.

Revision history for this message
Tom Davidson (tjd-mit) wrote :

Nothing? :)
http://fedoraproject.org/wiki/LifeCycle/EOL
FC6 was EOL'd on Dec 7, so as long as F7 F8 have newer versions of lxml, I'd vote for a 'known issues note' somewhere. While handy, these effects are not really critical features. (And I haven't found any other effects that exhibit the problem).

Revision history for this message
Aaron C Spike (acspike) wrote :

I think I've fixed all of these except the latex effect in svn rev 16939. I'm not sure how to fix latex extension because I've never used it, don't know how, and can't make it work.

Changed in inkscape:
status: Triaged → In Progress
Revision history for this message
Aaron C Spike (acspike) wrote :

I've installed the dependencies for the LaTeX Formula effect on win32 and I cannot reproduce the problem with lxml 1.3.6. Tom could you please test these again with a current build and close this bug if they are fixed?

Revision history for this message
Tom Davidson (tjd-mit) wrote :

Hi, yes, Lorem Ipsum, Barcode, and Gears are all working now! Latex unfortunately still triggers the error (pasted again below) using lxml 1.3.3. If it works in 1.3.6, I'd say it's not worth keeping the bug open, but I'll let you make that call, Aaron...

Tom

pstoedit: version 3.44 / DLL interface 108 (build Nov 23 2006 - release build - g++ 4.1.1 20061011 (Red Hat 4.1.1-30)) : Copyright (C) 1993 - 2006 Wolfgang Glunz
Traceback (most recent call last):
  File "/usr/local/share/inkscape/extensions/eqtexsvg.py", line 119, in ?
    e.affect()
  File "/usr/local/share/inkscape/extensions/inkex.py", line 154, in affect
    self.effect()
  File "/usr/local/share/inkscape/extensions/eqtexsvg.py", line 114, in effect
    svg_open(self, svg_file)
  File "/usr/local/share/inkscape/extensions/eqtexsvg.py", line 69, in svg_open
    group = clone_and_rewrite(self, svg)
  File "/usr/local/share/inkscape/extensions/eqtexsvg.py", line 53, in clone_and_rewrite
    node_out = inkex.etree.Element(inkex.addNS(node_in.tag,'svg'))
  File "etree.pyx", line 1801, in etree.Element
  File "apihelpers.pxi", line 101, in etree._makeElement
  File "apihelpers.pxi", line 712, in etree._getNsTag
ValueError: Invalid tag name

Revision history for this message
Tom Davidson (tjd-mit) wrote :

Forgot to add: this was using SVN rev 17171.

Revision history for this message
Aaron C Spike (acspike) wrote : Re: [Bug 179770] Re: Several effects broken with python error 'invalid tag name'

Tom Davidson wrote:
> Hi, yes, Lorem Ipsum, Barcode, and Gears are all working now! Latex
> unfortunately still triggers the error (pasted again below) using lxml
> 1.3.3. If it works in 1.3.6, I'd say it's not worth keeping the bug
> open, but I'll let you make that call, Aaron...

I'd prefer to get it fixed before I close it. I don't think I see the
problem with 1.3.3 on windows, but I'll check again.

> pstoedit: version 3.44 / DLL interface 108 (build Nov 23 2006 - release build - g++ 4.1.1 20061011 (Red Hat 4.1.1-30)) : Copyright (C) 1993 - 2006 Wolfgang Glunz
> Traceback (most recent call last):
> File "/usr/local/share/inkscape/extensions/eqtexsvg.py", line 119, in ?
> e.affect()
> File "/usr/local/share/inkscape/extensions/inkex.py", line 154, in affect
> self.effect()
> File "/usr/local/share/inkscape/extensions/eqtexsvg.py", line 114, in effect
> svg_open(self, svg_file)
> File "/usr/local/share/inkscape/extensions/eqtexsvg.py", line 69, in svg_open
> group = clone_and_rewrite(self, svg)
> File "/usr/local/share/inkscape/extensions/eqtexsvg.py", line 53, in clone_and_rewrite
> node_out = inkex.etree.Element(inkex.addNS(node_in.tag,'svg'))

are you at all comfortable with python? if so you could help me, what
happens if you put

inkex.debug(inkex.addNS(node_in.tag,'svg'))

right above line 53?

Aaron

Revision history for this message
Tom Davidson (tjd-mit) wrote :

The only difference I see is that the error now happens at line 54 :) . No
extra output to command line. Is there some log file generated or something?

pstoedit: version 3.44 / DLL interface 108 (build Nov 23 2006 - release
build - g++ 4.1.1 20061011 (Red Hat 4.1.1-30)) : Copyright (C) 1993 - 2006
Wolfgang Glunz
{http://www.w3.org/2000/svg}{http://www.w3.org/2000/svg}svg
Traceback (most recent call last):
  File "/usr/local/share/inkscape/extensions/eqtexsvg.py", line 120, in ?
    e.affect()
  File "/usr/local/share/inkscape/extensions/inkex.py", line 154, in affect
    self.effect()
  File "/usr/local/share/inkscape/extensions/eqtexsvg.py", line 115, in
effect
    svg_open(self, svg_file)
  File "/usr/local/share/inkscape/extensions/eqtexsvg.py", line 70, in
svg_open
    group = clone_and_rewrite(self, svg)
  File "/usr/local/share/inkscape/extensions/eqtexsvg.py", line 54, in
clone_and_rewrite
    node_out = inkex.etree.Element(inkex.addNS(node_in.tag,'svg'))
  File "etree.pyx", line 1801, in etree.Element
  File "apihelpers.pxi", line 101, in etree._makeElement
  File "apihelpers.pxi", line 712, in etree._getNsTag
ValueError: Invalid tag name

On Jan 24, 2008 2:11 PM, Aaron Spike <email address hidden> wrote:

> Tom Davidson wrote:
> > Hi, yes, Lorem Ipsum, Barcode, and Gears are all working now! Latex
> > unfortunately still triggers the error (pasted again below) using lxml
> > 1.3.3. If it works in 1.3.6, I'd say it's not worth keeping the bug
> > open, but I'll let you make that call, Aaron...
>
> I'd prefer to get it fixed before I close it. I don't think I see the
> problem with 1.3.3 on windows, but I'll check again.
>
> > pstoedit: version 3.44 / DLL interface 108 (build Nov 23 2006 - release
> build - g++ 4.1.1 20061011 (Red Hat 4.1.1-30)) : Copyright (C) 1993 - 2006
> Wolfgang Glunz
> > Traceback (most recent call last):
> > File "/usr/local/share/inkscape/extensions/eqtexsvg.py", line 119, in
> ?
> > e.affect()
> > File "/usr/local/share/inkscape/extensions/inkex.py", line 154, in
> affect
> > self.effect()
> > File "/usr/local/share/inkscape/extensions/eqtexsvg.py", line 114, in
> effect
> > svg_open(self, svg_file)
> > File "/usr/local/share/inkscape/extensions/eqtexsvg.py", line 69, in
> svg_open
> > group = clone_and_rewrite(self, svg)
> > File "/usr/local/share/inkscape/extensions/eqtexsvg.py", line 53, in
> clone_and_rewrite
> > node_out = inkex.etree.Element(inkex.addNS(node_in.tag,'svg'))
>
> are you at all comfortable with python? if so you could help me, what
> happens if you put
>
> inkex.debug(inkex.addNS(node_in.tag,'svg'))
>
> right above line 53?
>
> Aaron
>
> --
> Several effects broken with python error 'invalid tag name'
> https://bugs.launchpad.net/bugs/179770
> You received this bug notification because you are a direct subscriber
> of the bug.
>

Revision history for this message
Aaron C Spike (acspike) wrote : Re: [Bug 179770] Re: Several effects broken with python error 'invalid tag name'

Tom Davidson wrote:
> {http://www.w3.org/2000/svg}{http://www.w3.org/2000/svg}svg

Perfect. I've committed a probably fix in r17176. Please test.

Aaron

Revision history for this message
Tom Davidson (tjd-mit) wrote :

Yes, that did the trick. I think you have removed the last vestiges of this bug. Now, the Latex formula extension still doesn't seem to *do* anything when I run it, but I've never had it working, so there's no reason to think this is related to this bug--marking fix released...

Changed in inkscape:
status: In Progress → Fix Released
Revision history for this message
Aaron C Spike (acspike) wrote : Re: [Bug 179770] Re: Several effects broken with python error 'invalid tag name'

That is a bit disheartening. It has been working for me on Windows since
I installed all the deps and added them to my path. But I've never seen
it work on Linux. For me on Linux it hangs and gs uses 99% CPU.

Aaron

Revision history for this message
Tom Davidson (tjd-mit) wrote :

Is there some trick to running the script? Is it like
Effects->Render->Function Plotter where you have to draw and select a
rectangle first? To test, I've just been opening a brand new document, and
hitting the Latex effect, using the default formula that's in there:
   \(\displaystyle\frac{\pi^2}{6}=\lim_{n \to \infty}\sum_{k=1}^n
\frac{1}{k^2}\)

When I run it this way, I get the "'Latex Formula' working, please wait"
dialog, then the "Inkscape has received additional info from the script..."
dialog pops up with the annoying pstoedit copyright message ('pstoedit:
version 3.44 / DLL interface 108 (build Nov 23 2006 - release build - g++
4.1.1 20061011 (Red Hat 4.1.1-30)) : Copyright (C) 1993 - 2006 Wolfgang
Glunz'). When I dismiss that, I get the following error to the console:

** (inkscape:20974): CRITICAL **: void Inkscape::GC::Anchored::release()
const: assertion `_anchor' failed

... but it doesn't hang for me. Nothing is drawn to the canvas. If I run it
again, I don't get the **CRITICAL** warning again...

I have:
tetex-latex-3.0-36.fc6
tetex-dvips-3.0-36.fc6
tetex-fonts-3.0-36.fc6
tetex-3.0-36.fc6
ghostscript-fonts-5.50-13.1.1
ghostscript-8.15.4-1.fc6

And am running inkscape from today's SVN...

On Jan 25, 2008 12:40 PM, Aaron Spike <email address hidden> wrote:

> That is a bit disheartening. It has been working for me on Windows since
> I installed all the deps and added them to my path. But I've never seen
> it work on Linux. For me on Linux it hangs and gs uses 99% CPU.
>
> Aaron
>
> --
> Several effects broken with python error 'invalid tag name'
> https://bugs.launchpad.net/bugs/179770
> You received this bug notification because you are a direct subscriber
> of the bug.
>

Revision history for this message
xylo (stefan-endrullis) wrote :

Same for me. I don't get the error "[...] Tag names must not contain ':', lxml 2.0 will enforce well-formed tag [...]" anymore, but the latex extension is still not rendering the formula.

The message I get is a one-liner:
 pstoedit: version 3.45 / DLL interface 108 (build Nov 28 2007 - release build - g++ 4.2.3 20071123 (prerelease) (Ubuntu 4.2.2-3ubuntu4)) : Copyright (C) 1993 - 2007 Wolfgang Glunz

The CPU consumption is only 1%.

Are there special dependencies?

I have
Python 2.5.1
python-lxml 1.3.3
pstoedit: version 3.45 / DLL interface 108 (build Nov 28 2007 ...
Inkscape 0.45.1+0.46pre1, built Feb 5 2008

Revision history for this message
xylo (stefan-endrullis) wrote :

Today I've tested the latex extension with Inkscape 0.45.1+0.46pre1, built Feb 20 2008, but it's still the same. The other extensions like grid, barcode, function plotter, gears are working on my Ubuntu system. So what's wrong with the latex extension? Seems not to be related to this bug. Is the extension currently working for anybody?

I don't know if bug 194310 solves the problem. I will test it under Linux.

Revision history for this message
xylo (stefan-endrullis) wrote :

Because this bug report is already closed I have reported a new bug for the latex problem (see bug 195052).

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.