Got it:
exec('self.' + attr + '=\'' + val + '\'')
That worked. I think it'll do what you want now ;)
Ching-Yun "Xavier" Ho, Technical Artist
Contact Information
Mobile: (+61) 04 3335 4748
Skype ID: SpaXe85
Email: cont...@xavierho.com <mailto:cont...@xavierho.com>
Website: http://xavierho.com/
To bad, that didn't worked in my class. Still the same error:
"
>>> mod.print_module('socket')
Traceback (most recent call last):
File "<pyshell#121>", line 1, in <module>
mod.print_module('socket')
File "<pyshell#118>", line 51, in print_module
module_open = open(self._this_module, 'rb')
IOError: [Errno 2] No such file or directory: ''
>>>
"
:-/
What is the point of the _SetVar method?
Instead of:
self._SetVar(self._this_module, os.path.join(root, f))
just do:
self._this_module = os.path.join(root, f)
(unless I'm misunderstanding what you're trying to do!)
Of course i;ve tried, but still get the same error:
"
>>> mod.print_module('socket')
Traceback (most recent call last):
File "<pyshell#121>", line 1, in <module>
mod.print_module('socket')
File "<pyshell#118>", line 51, in print_module
module_open = open(self.this_module, 'rb')
IOError: [Errno 2] No such file or directory: ''
>>>
"
It looks like private variable have specific naure, that prevent from
traditional editing them.
Still searching for some tuts about private methods and variables.
--
http://mail.python.org/mailman/listinfo/python-list