newbie - How do I import automatically?

Claudio Grondi claudio.grondi at freenet.de
Thu Nov 17 06:05:58 EST 2005


The only difference I can see is,

that you are on Python 2.3.4 and I use Python 2.4.2:
"Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on
win32 - IDLE 1.1.2"

So maybe if you upgrade ... this will become obsolete?

Claudio

"Mikael Olofsson" <mikael at isy.liu.se> schrieb im Newsbeitrag
news:dlhjtp$jhd$1 at news.island.liu.se...
> bobueland at yahoo.com wrote:
> > I tried to do it on my computer (win XP). I put an extra line in
> > PyShell.py
> > [snip]
> > # test
> > sys.modules['__main__'].__dict__['os'] = os
> > [snip]
> > Then when I start idle I get
> >
> > IDLE 1.1.1
> >
> >>>>dir()
> >
> > ['__builtins__', '__doc__', '__name__']
> >
> >
> > So I don't see 'os'
> >
> > Do you see 'os' on your computer. If yes, what could be the difference?
>
> Yes, I do. The following is with IDLE 1.0.3 and Python 2.3.4 on WinXP.
>
> Without the line in PyShell.py:
>
>      IDLE 1.0.3      ==== No Subprocess ====
>      >>> dir()
>      ['__builtins__', '__doc__', '__file__', '__name__', 'main']
>
> With the line in PyShell.py:
>
>      IDLE 1.0.3      ==== No Subprocess ====
>      >>> dir()
>      ['__builtins__', '__doc__', '__file__', '__name__', 'main', 'os']
>      >>> os
>      <module 'os' from 'C:\Python23\lib\os.pyc'>
>
> I know nothing about the details of how IDLE work. All I know is what I
> have reported here. I was simply inspired by the following remark from
> Claudio Grondi up-thread:
>
>  > edit the first lines of %SystemDrive%\Python24\Lib\idlelib\PyShell.py
>
> I guess that PyShell.py is imported as a module by IDLE at startup.
>
> One thought, though: Du you have more than one Python installed? If so:
> Could it be that you are editing the wrong PyShell.py?
>
> Regards
> /MiO





More information about the Python-list mailing list