Configuring wingdbstub

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


In some cases you may need to alter other preset configuration values at the start of wingdbstub.py. These values completely replace the corresponding values set in Project Properties File Properties, and Launch Configurations in the IDE. Those are used only when the debug process is launched from Wing.

The following options are available:

  • Set kWingDebugDisabled=1 to disable the debugger entirely. This is equivalent to setting the WINGDB_DISABLED environment variable before starting debug.
  • Set kWingHostPort to specify where Wing is listening for connections from externally launched debug processes, so the debugger can connect to it when it starts. This is equivalent to setting the WINGDB_HOSTPORT environment variable before starting debug. The default value is localhost:50005.

    Note that hostname will still be localhost if you are debugging over an SSH tunnel, as will be the case if you are using a remote host configuration. The SSH tunnel takes care of listening on localhost and then tunnels the connection to the host where the IDE is running.

    See Manually Configured Remote Debugging for details on changing this value.

  • Set KLogFile to write a diagnostic log of debugger activity to a file. Usually, you should set this only at the request of Wingware Technical Support. This is equivalent to setting the WINGDB_LOGFILE environment variable before starting debug (use a value of - to turn off logging to file even if kLogFile is set).

    When setting this value to a file name, the file will be created if it does not exist. Similarly named files are created if multiple processes are being debugged, one for each process.

    Use <stdout> or <stderr> to write to Python's sys.stdout or sys.stderr. Note that using <stderr> will cause problems on Windows if the debug process is not running in a console.

  • Set kEmbedded to 1 when debugging embedded scripts, so the debug connection will be maintained across script invocations, rather than closing the debug connection when the script finishes. This is equivalent to setting the environment variable WINGDB_EMBEDDED. See Debugging Embedded Python Code for details.
  • Set kAttachPort to define the default port at which the debug process will listen for requests to attach. This is available in Wing Pro only and is equivalent to setting the WINGDB_ATTACHPORT environment variable before starting debug.

    If this value is less than 0, the debug process does not listen for attach requests. Otherwise, the debugger listens on this port whenever the debug process is running without being connected to the IDE, as might occur if it initially fails to connect or if the IDE detaches from the process.

    See Attaching and Detaching for details.

  • Set kPWFilePath and kPWFileName tell the debugger where to find the security token file. This is equivalent to setting the environment variables WINGDB_PWFILEPATH and WINGDB_PWFILENAME before starting debug.

    kPWFilePath should be a Python list of strings containing directory names 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 the Settings Directory for the user that is running the debug process.

    kPWFileName sets the file name to use for the security token. The default is wingdebugpw.

  • Set WINGHOME to the Wing installation directory (or the name of Wing's .app folder on OS X) so that wingdbstub.py can find the debugger. This is equivalent to setting the environment variable WINGHOME before starting debug.

    For Windows and Linux, and for copies of wingdbstub.py in a remote agent installation, WINGHOME will usually be set automatically during installation. The value may need to be set on OS X, if Wing was installed from the .zip installer on Windows or the .tar installer on Linux, if running Wing from sources, or if configuring remote debug manually.

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