inspect.stack() or inspect.currentframe() gives "list index out of range error"

Wolfgang Rohdewald wolfgang at
Sat Sep 25 13:28:33 CEST 2010

On Samstag 25 September 2010, Steven D'Aprano wrote:
> My guess is that you've copied the .pyc file onto the server,
> BUT there  is also an older version of the .py file there as
> well. Because the modification date is older than that of the
> .pyc file, Python executes the compiled code from the .pyc
> file.

that would be horrible - this is what our own legacy software
does. A maintenance nightmare. Think adjusting system time
or "cp -a"

Actually the docs say something different:

The modification time of the version of used to create 
spam.pyc is recorded in spam.pyc, and the .pyc file is ignored if 
these don’t match.

found here:


More information about the Python-list mailing list