"Mikael Olofsson" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] > [EMAIL PROTECTED] wrote: > > I tried to put the line > > from btools import * > > in several places in PyShell.py > > but to now avail. It does not work, IDLE does not execute it??? > > IDLE definitely executes PyShell.py upon startup, since IDLE does not > even appear on the screen if there is an error in that file. The > following seems to work for me, in PyShell.py. After importing both sys > and os, > > sys.modules['__main__'].__dict__['os'] = os > > Then, if I start IDLE, the module os is directly available. > > HTH > /MiO
I have put sys.modules['__main__'].__dict__['os'] = os at the beginning of PyShell.py : " #! /usr/bin/env python import os import os.path import sys sys.modules['__main__'].__dict__['os'] = os " and also here: " class ModifiedInterpreter(InteractiveInterpreter): def __init__(self, tkconsole): self.tkconsole = tkconsole sys.modules['__main__'].__dict__['os'] = os locals = sys.modules['__main__'].__dict__ " but it does not work ... (why ???) What happens if you remove the line sys.modules['__main__'].__dict__['os'] = os from your PyShell.py? Will os be no more available or is it still there? Claudio -- http://mail.python.org/mailman/listinfo/python-list