[PythonCAD] File saving bug in eighteenth release

Art Haas ahaas at airmail.net
Sat Nov 13 17:20:04 CET 2004


I've been informed that there is a bug in saving files with the
eighteenth release. Specifically it is when loading up older files and
then trying to save them. After poking around a bit I've duplicated the
problem here, and it looks like it would affect drawings that have text
entities. Drawings without text seem to save correctly.

I've made the patch below and sent it to the person reporting the bug.
On my test case the patch fixed the problem. 

If you've downloaded the eighteenth release, please apply this patch.
I'm almost certainly going to make a nineteenth release today, but I do
want to hear that this patch fixes the bug that was reported to me.

If you care to test it, find an older drawing you've made that has some
text entities, and make a copy that you can test with. Load up your
copy, and try to save it. If the save fails, apply the patch below to
the eighteenth release, then again copy your test drawing, load it up,
then save. It should save successfully.

Art Haas

Index: PythonCAD/Generic/text.py
--- PythonCAD/Generic/text.py	(revision 1374)
+++ PythonCAD/Generic/text.py	(working copy)
@@ -34,11 +34,11 @@
-    if style == NORMAL:
+    if style == TextStyle.FONT_NORMAL:
         _str = 'normal'
-    elif style == OBLIQUE:
+    elif style == TextStyle.FONT_OBLIQUE:
         _str = 'oblique'
-    elif style == ITALIC:
+    elif style == TextStyle.FONT_ITALIC:
         _str = 'italic'
         raise ValueError, "Unknown font style: " + str(style)
@@ -49,13 +49,13 @@
-    if weight == NORMAL:
+    if weight == TextStyle.WEIGHT_NORMAL:
         _str = 'normal'
-    elif weight == LIGHT:
+    elif weight == TextStyle.WEIGHT_LIGHT:
         _str = 'light'
-    elif weight == BOLD:
+    elif weight == TextStyle.WEIGHT_BOLD:
         _str = 'bold'
-    elif weight == HEAVY:
+    elif weight == TextStyle.WEIGHT_HEAVY:
         _str = 'heavy'
         raise ValueError, "Unknown font weight: " + str(weight)
Man once surrendering his reason, has no remaining guard against absurdities
the most monstrous, and like a ship without rudder, is the sport of every wind.

-Thomas Jefferson to James Smith, 1822

More information about the PythonCAD mailing list