klayout icon indicating copy to clipboard operation
klayout copied to clipboard

Python LYM with a "less than <" character in the <text> ~~~ </text> block

Open Kazzz-S opened this issue 5 years ago • 2 comments

LessThanChar.zip

The attached ZIP contains two very simple LYMs. They differ in an if statement, as shown below. Count_1 does not show up in the menu, but Count_2 does. I've confirmed this issue with KLyout-0.26.8 on Mac and Linux.

MacBookPro2{kazzz-S}(3)$ diff count1.lym count2.lym
3c3
<  <description>Count_1</description>>
---
>  <description>Count_2</description>>
22c22
<   if count < 10:
---
>   if count &lt; 10:

Kazzz-S

Kazzz-S avatar Oct 17 '20 04:10 Kazzz-S

@Kazzz-S Thanks for reporting this issue!

I just wonder how this could happen. If I write a LYM and save it, there should not be an "<" character. Instead it should be replaced by &lt;.

With the "<", the file isn't valid XML and can't be read. So the only solution is to prevent such files can be created.

Matthias

klayoutmatthias avatar Oct 26 '20 22:10 klayoutmatthias

As you mentioned here,

And I still wonder how the "<" character gets into the .lym files - maybe they were edited manually?

I used an external text editor and inserted my Python code to the <text>~~~</text> block manually.

Kazzz-S

Kazzz-S avatar Oct 27 '20 09:10 Kazzz-S