Home » Support » Index of All Documentation » Wing Pro Reference Manual » Advanced Debugging Topics » Debugging Externally Launched Code »

Debug Server Configuration


In some cases you may also need to alter other preset configuration values at the start of wingdbstub.py. These values completely replace any values set in Wing's Project or File Properties, which are relevant only when the debug program is launched from within Wing. The following options are available:

  • The debugger can be disabled entirely with kWingDebugDisabled=1. This is equivalent to setting the WINGDB_DISABLED environment variable before launching the debug program.
  • Set kWingHostPort to specify the network location of Wing, so the debugger can connect to it when it starts. This is equivalent to setting the WINGDB_HOSTPORT environment variable before launching the debug program. The default value is localhost:50005. See section Remote Debugging for details if you need to change this value.
  • You can control whether or not the debugger's internal error messages are written to a log file by setting kLogFile. You should set this only at the request of Wingware Technical Support. Use <stdout>, <stderr>, or a file name. If the given file doesn't exist, it is created if possible. Note that using <stderr> may cause problems on Windows if the debug process is not running in a console. This is equivalent to setting the WINGDB_LOGFILE environment variable before launching the debug program (use a value of - to turn off logging to file).
  • Set kEmbedded to 1 when debugging embedded scripts. In this case, the debug connection will be maintained across script invocations instead of closing the debug connection when the script finishes. When this is set to 1, you may need to call wingdbstub.debugger.ProgramQuit() before your program exits, or before it discards an instance of Python, in order to cleanly close the debug connection to the IDE. This is equivalent to setting the environment variable WINGDB_EMBEDDED.
  • Set kAttachPort to define the default port at which the debug process will listen for requests to attach (available in Wing Pro only). This is equivalent to setting the WINGDB_ATTACHPORT environment variable before launching the debug program. If this value is less than 0, the debug process will never listen for attach requests. If it is greater than or equal to 0, this value is used when the debug process is running without being in contact with Wing, as might happen if it initially fails to connect to the above-defined host and port, or if the IDE detaches from the process for a period of time. For Wing Pro, this is described in more detail in section Attaching and Detaching.
  • Set kPWFilePath and kPWFileName to define the search path and file name used to find a wingdebugpw file for the debugger. The environment variables WINGDB_PWFILEPATH and WINGDB_PWFILENAME will override these settings. The file path should be a Python list of strings if set in wingdbstub.py or a list of directories separated by the path separator (os.pathsep) when sent by environment variable. The string $<winguserprofile> may be used to specify Wing's User Settings Directory for the user that the debug process is running as. The password file name is usually wingdebugpw but may be changed in cases where this naming is inconvenient.
  • Optionally, set WINGHOME, which is the Wing installation directory (or the name of Wing's .app folder on OS X). This is set up during installation, but may need to be altered if you are running Wing from source or copied the debugger binaries over from another machine.

Setting any of the above-described environment variable equivalents will override the value given in the wingdbstub.py file.

Debug Server Configuration