From 586b5685f550439fb5b0da9dd1121fd0c204682c Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Thu, 4 Nov 2010 21:32:11 +0000 Subject: [PATCH] Improve hex2ratio. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36090 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/lyx2lyx/lyx2lyx_tools.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/lyx2lyx/lyx2lyx_tools.py b/lib/lyx2lyx/lyx2lyx_tools.py index 9e79b2d6fd..42ed89da98 100644 --- a/lib/lyx2lyx/lyx2lyx_tools.py +++ b/lib/lyx2lyx/lyx2lyx_tools.py @@ -352,8 +352,11 @@ def revert_layout_command(document, name, LaTeXname, position): def hex2ratio(s): - val = string.atoi(s, 16) - if val != 0: - val += 1 - return str(val / 256.0) + try: + val = int(s, 16) + except: + val = 0 + if val != 0: + val += 1 + return str(val / 256.0)