Customizing interpreter behavior [was: Clearing the screen]

Steve Holden steve at holdenweb.com
Mon Dec 27 08:32:14 EST 2004


John Machin wrote:

> Ishwor wrote:
> 
> 
>>i was just tinkering with it actually. ;-)
>>In your command prompt just do
>>Pythonwin.exe /run "C:\Python24\file\PyFiles\clear.py"
> 
> 
> It's not a very good idea to store your own scripts in the PythonXY
> directory -- other than tested working modules which you install in
> PythonXY\lib\site-packages.
> E.g. what will you do when Python 2.5 arrives?
> 

As has been recently pointed out in another thread, the interpreter 
(actually, code in the "site" module) searches for a "sitecustomize" 
module when starting up. This is the easiest way to implement required 
startup behavior no matter what environment the interpreter's running 
in. For more information, RTFM concerning the "site" module, whose 
documentation includes the following:

"""After these path manipulations, an attempt is made to import a module 
named sitecustomize, which can perform arbitrary site-specific 
customizations. If this import fails with an ImportError exception, it 
is silently ignored."""

regards
  Steve
-- 
Steve Holden               http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
Holden Web LLC      +1 703 861 4237  +1 800 494 3119



More information about the Python-list mailing list