1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
Invocation
==========
When WPY starts up it will search for a DLL with the same name
as the executable file. That is, it will search for "wpy_nt.dll".
If you rename wpy_nt.exe to "myprog.exe", then it will search
for "myprog.dll". The search uses
the usual search path for DLL's. It will then try to get the
address of the exported symbol "PyImport_FrozenModules" in the DLL.
This must be in the form of the frozen module array (see frozen.c).
If all this succeeds, then the frozen modules in the DLL replace the
frozen modules in the executable.
If this fails, the default frozen modules are used. This enables the
programmer to put modules into the DLL, and access them
using the usual frozen module access methods.
When WPY starts up, it will set up sys.argv[] to its
program arguments. Under Windows, argv[0] is guaranteed to be
the full path to the executable file. The first argument which does
not start with '-' is a program to run. For example "wpy_nt myprog.py".
If no program
is specified, it will import and run the frozen module named "__main__".
If there is no such module, it will import the module "wpyinter.py"
which is a simple interactive window for Python statements.
The programmer can provide a replacement for wpyinter.py, and that
program will be started by default.
When WPY is imported, it sets sys.stdout and sys.stderr to an instance
wpy.wpyStdOut of class wpy.WpyStdOut. This has a write method which directs
output from print statements and tracebacks etc. to a message box. Output
is collected until the system is idle before the message box is displayed.
This makes it easy to create a dialog box out of print statements. And
under Windows, this output would be lost unless the program was started
from a console. But an exception may cause output to be lost.
To return sys.stdout/err to the original values so output appears on
the console, execute the method wpy.wpyStdOut.Restore().
|