Trace dynamically compiled code?

2006-03-14 Thread Ed Leafe
Hi, Thanks to the help of many on this list, I've been able to take code that is created by the user in my app and add it to an object as an instance method. The technique used is roughly: nm = myMethod code = def myMethod(self): print Line 1 print My Value is %s % self.Value

Re: Trace dynamically compiled code?

2006-03-14 Thread Thomas Heller
Ed Leafe wrote: Hi, Thanks to the help of many on this list, I've been able to take code that is created by the user in my app and add it to an object as an instance method. The technique used is roughly: nm = myMethod code = def myMethod(self): print Line 1 print My

Re: Trace dynamically compiled code?

2006-03-14 Thread Ziga Seilnacht
Ed Leafe wrote: Hi, Thanks to the help of many on this list, I've been able to take code that is created by the user in my app and add it to an object as an instance method. The technique used is roughly: Just some notes about your code: nm = myMethod code = def myMethod(self):

Re: Trace dynamically compiled code?

2006-03-14 Thread Ed Leafe
On Mar 14, 2006, at 12:45 PM, Ziga Seilnacht wrote: Try not using bare exec statements, since they pollute the local scope. In your example you could use: compCode = compile(code, , exec) d = {} exec compCode in d func = d[nm] OK, noted and changed in my source. exec self.%s