diff --git a/pycscope/__init__.py b/pycscope/__init__.py index e0adc90..eac8252 100755 --- a/pycscope/__init__.py +++ b/pycscope/__init__.py @@ -22,7 +22,7 @@ import getopt, sys, os, string, re import keyword, parser, symbol, token - +import tokenize class Mark(object): """ Marks, as defined by Cscope, that are implemented. @@ -222,7 +222,7 @@ def parseFile(basepath, relpath, indexbuff, indexbuff_len, fnamesbuff, dump=Fals # Open the file and get the contents fullpath = os.path.join(basepath, relpath) try: - f = open(fullpath, 'rU') + f = tokenize.open(fullpath) except IOError as e: # Can't open a file, emit message and ignore print("pycscope.py: %s" % e)