newbie - How do I import automatically?

bobueland at yahoo.com bobueland at yahoo.com
Thu Nov 17 04:25:59 EST 2005


I tried to do it on my computer (win XP). I put an extra line in
PyShell.py

#! /usr/bin/env python

import os
import os.path
import sys
import string
import getopt
import re
import socket
import time
import threading
import traceback
import types
import exceptions

# test
sys.modules['__main__'].__dict__['os'] = os

import linecache

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?

Bob




More information about the Python-list mailing list