[Python-Dev] Py3k: error byte-compiling with distutils

Lisandro Dalcin dalcinl at gmail.com
Tue Jul 24 18:09:06 CEST 2007

I'm porting some of my code to py3k, and I started from the C size.
After this, all extensions compiled fine, but after a 'setup.py
install', I got the following:

  File "/usr/local/python/3.0/lib/python3.0/distutils/util.py", line
498, in byte_compile
    compile(file, cfile, dfile)
  File "/usr/local/python/3.0/lib/python3.0/py_compile.py", line 127, in compile
    py_exc = PyCompileError(err.__class__,err.args,dfile or file)
  File "/usr/local/python/3.0/lib/python3.0/py_compile.py", line 48, in __init__
    tbtext = ''.join(traceback.format_exception_only(exc_type, exc_value))
  File "/usr/local/python/3.0/lib/python3.0/traceback.py", line 196,
in format_exception_only
    lines.append("%s: %s\n" % (stype, str(msg)))
UnboundLocalError: local variable 'msg' referenced before assignment

At this point, I had not updated my python code, so it surelly had
some py3k-invalid things. Looking at 'traceback.py', it seems there is
something wrong in 'format_exception_only', so this error.

Lisandro Dalcín
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594

More information about the Python-Dev mailing list