Saturday, October 16, 2010

Python engine initialization

Starting from the just released version 2.3.1, PyScripter users can create two startup python files that can be run at PyScripter startup.

1.   pyscripter_init.py
This script is run once in the space of the internal Python engine at start-up.  It can be used to set various PyScripter options and to customize the PyScripter user environment.

2.   python_init.py
            This file is executed when a Python engine, internal or remote, is initialized and every time the engine is reinitialized.  It can be used to customize the Python engine, for example by always importing certain units or modifying sys.path.
 
You can edit the startup files by using the new Tools menu command "Edit Startup Files".
 
PyScripter searches for startup python files first at the PyScripter.exe directory, and, if it they are not found there, at %APPDATA%\Pyscripter, where %APPDATA% is the environment variable.  The PyScripter installation program places these files without any content at %APPDATA%\Pyscripter, if the files are not there already.

TIP:  This not documented but internally PyScripter uses the following
method to prevent debugging certain modules:


__import__('module name').__traceable__ = 0

You can include such statements in python_init.py to prevent stepping into certain units.


 

No comments: