why does py_compile.compile() miss some errors in sourcefile?

Frank Bechmann fBechmann at web.de
Mon Dec 29 02:16:18 EST 2003


where can I find some documentation, which errors will be found by
'py_compile.compile' and which will not be found.

# t1.py
# =====

import os.path
import py_compile

py_compile.compile(os.path.join(os.path.dirname(__file__), "t2.py"),
                    doraise=True)


# t2.py
# =====
# following line is found as an error:
# Class C:  # <== 'SyntaxError: invalid syntax'

class C:
    pass

c = CC()    # <== not found as an error from py_compile
            #   but found as an error from python-executable:
            #   'NameError: name 'CC' is not defined'

thx in advance




More information about the Python-list mailing list