From: Jeroen Ruigrok van der Werven Date: Fri, 2 May 2008 22:13:17 +0000 (+0000) Subject: Reinstate changeset r362, but this time properly wrap the exception list in X-Git-Tag: 1.0~347 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dd214f0c8d4ea0acc13db4d7953d36c503e62985;p=thirdparty%2Fbabel.git Reinstate changeset r362, but this time properly wrap the exception list in braces. Submitted by: cboos --- diff --git a/babel/util.py b/babel/util.py index 2ef92d65..47f59afe 100644 --- 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 @@ def parse_encoding(fp): 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