# HG changeset patch # User cmlenz # Date 1207918272 0 # Node ID 0e1049d9c81dc6d413b5cbb848b74061d7d25303 # Parent 5888bd8c57331add1682cec6fb1c2d0baa95c012 Make dependency on the parser module optional. diff --git a/babel/util.py b/babel/util.py --- a/babel/util.py +++ b/babel/util.py @@ -16,7 +16,6 @@ import codecs from datetime import timedelta, tzinfo import os -import parser import re try: set @@ -75,8 +74,9 @@ m = PYTHON_MAGIC_COMMENT_re.match(line1) if not m: try: + import parser parser.suite(line1) - except SyntaxError: + except ImportError, SyntaxError: # Either it's a real syntax error, in which case the source is # not valid python source, or line2 is a continuation of line1, # in which case we don't want to scan line2 for a magic