# HG changeset patch # User cmlenz # Date 1207918272 0 # Node ID 6b653a02c7f1fdfcd9acc4d3c07aef94af09a222 # Parent 94507c5de7d58664cd7a13020108b4ea751ad086 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