Hi Friends I'm getting the TypeError Unsubscriptable object when using Exec in a class
Here's the example class Fake(object): def __init__(self, reg): self._reg = reg def OpenKey(self, rootkey, path): open_key = self._reg path_string='[\'HKLM\']' for key in path.split('\\'): path_string += '[\'%s\']'%key a='d=open_key%s'%path_string exec(a) return d When i create a claassobject and call the method Openkey i get the above error but it works fine in the below example without class def OpenKey(rootkey, path, reg): open_key = reg path_string='[\'HKLM\']' for key in path.split('\\'): path_string += '[\'%s\']'%key a='d=open_key%s'%path_string print a exec(a) return d What am i doing wrong in the class?Any thought on this would be helpful :) Thanks in Advance
-- http://mail.python.org/mailman/listinfo/python-list