I already posted this in the Google Group (which now I realize may not be appropriate since I noticed there is a bug tracker, so I am posting it here now).
When I try to run this code in Reinteract I get this error:
f=open('test.txt','wb')
IOError: file() constructor not accessible in restricted mode.
I am using:
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit
(Intel)] on win32
and the latest version of Reinteract from "git clone git://git.fishsoup.net/reinteract"
Making these changes to create_builtins() (and no other changes) also
fixes the issue:
def create_builtins(self):
# __builtins__ is a dict for a module, but a module for
__main__
if isinstance(__builtins__, dict):
builtins = __builtins__ #copy.copy(__builtins__)
d = builtins
else:
#builtins = imp.new_module("__reinteract_builtin__")
#builtins.__dict__.update(__builtins__.__dict__)
builtins = __builtins__
d = builtins.__dict__
d['__import__'] = self.do_import
d['help'] = _Helper()
return builtins
I guess I am not sure what the replacement of __import__ by do_import
is for, so I don't know what this might break, by only doing this
replacement if __builtins__ is a module or not doing it at all. If i
leave the __import__ replacement for both cases i get import errors in
the console when I try to type in the Reinteract window.