In 2.4 at least, it looks like execfile can take an arbirary mapping
object for globals, so something like this may work:
class LoggedDict(dict):
def __setitem__(self, item, val):
dict.__setitem__(self, item, val)
# Do whatever logging is needed here
print "Assignment m
Jacek Generowicz wrote:
> Inspecting the implementation of execfile suggests to me that the
> assignments are performed by a hard-wired call to PyDict_SetItem, in
> the opcode implementations, so it looks like ideas based on giving
> execfile a globals dictionary with an instrumented __setitem__ a
Larry Bates <[EMAIL PROTECTED]> writes:
> Suggestion:
> Use ConfigParser to set your globals instead and you can track
> your assignments over each file, section and option in the file.
I would dearly love to go down this sort of route but, unfortunately,
they are not _my_ configuration files, an
Jacek Generowicz wrote:
> I am dealing with an application which reads in configurations by
> calling (a wrapper around) execfile. Any configuration file may itself
> execfile other configuration files in the same manner.
>
> I would like to create a log containing all global assignments made in
>
I am dealing with an application which reads in configurations by
calling (a wrapper around) execfile. Any configuration file may itself
execfile other configuration files in the same manner.
I would like to create a log containing all global assignments made in
these files. Comparing the globals