<type>how-to</type>
<domain>install</domain>
<id>cygwin</id>
<title>Using Wing with Cygwin</title>
<date>$Date: 2006-12-28 17:21:43 -0500 (Thu, 28 Dec 2006) $</date>
<product>per+</product>
<summary>Learn how Wing can be used to speed up development and debugging of Python code written under cygwin, a Linux/Unix like environment for Microsoft Windows.</summary>

.. image:: /images/screenshots/wing7-screenshot-linen.png
  :alt: Wing Screen Shot
  :width: 574
  :height: 423
  :popup: 1

`Wing <https://wingware.com/>`__ is a Python IDE that can be used to develop, test, and
debug Python code written for `cygwin <https://www.cygwin.com/>`__, a Linux/Unix like
environment for Microsoft Windows.  

Two versions of Wing are appropriate for use with this document: Wing Pro is the
full-featured Python IDE for professional developers, and Wing Personal is a free
alternative with reduced feature set.

If you do not already have Wing installed, `download it now <https://wingware.com/downloads>`__.

This document describes how to configure Wing for Cygwin. To get started using Wing as
your Python IDE, please refer to the tutorial in Wing's ``Help`` menu or read the
`Quickstart Guide <ref:howtos/quickstart>`__.

**Note:** This document was last tested with cygwin 3.6.

Debugger Configuration
----------------------

To write and debug code running under cygwin, download and install Wing for Windows on
your machine. Wing does not run on cygwin but you can set up Wing for Windows to work with
Python code that is running under cygwin.

Cygwin has a different view of the file system than the paths used by Windows
applications. This causes problems when code is debugged since Wing cannot find the files
referenced by their cygwin name.

The solution to this problem is to treat Python running under cygwin as if it were running
on a separate system. This is described in `Debugging Externally Launched Code
<ref:debug/debugging-externally-launched-code>`__.  In this model, you will always launch
your Python code from cygwin rather than from Wing's menus or toolbar.

When setting this up according to the instructions provided by the above link, use cygwin
paths for ``WINGHOME`` in ``wingdbstub.py`` because this file will be used on the cygwin
side.

Wing will look for the ``wingdebugpw`` authentication token file in ``~~POSIX_USER_DIR~~``
on cygwin, if it exists. Otherwise the standard Windows `settings directory
<ref:install/user-settings-dir>`__ will be used.

You will also need to configure cygwin so that the cygwin pathnames are equivalent to the
Windows pathnames. An example would be to set up ``/src`` in cygwin to point to the same
directory as ``\src`` on Windows, which is ``src`` at top level of the main drive, usually
``c:\src``. Wing will ignore the difference between forward and backward slashes in path
names.

If you cannot set up matching cygwin and Windows paths like this, you will instead need to
use the `Debugger > Advanced > Location Map
<script:show_preferences_gui#prefname="debug.location-map">`__ preference to translate to
and from your cygwin names.  For example, if your cygwin files are at ``/c/src/test`` and
this directory is ``c:\\src\test`` on Windows then you would add a location map
entry as follows::

  Remote IP 127.0.0.1 - Remote: /c/src/test, Local: c:/src/test

Note the use of forward slashes in the the ``Local`` specification even though the file is
on Windows.

When in doubt, an easy way to determine the correct cygwin file path to use is to place
``assert 0`` into a file and refer to the traceback shown in the ``Exceptions`` tool in
Wing when the file is debugged via ``wingdbstub``.

Related Documents
-----------------

For more information see:

* `Cygwin home page <https://www.cygwin.com/>`__, which provides links to documentation.

* `Quickstart Guide <ref:howtos/quickstart>`__ contains additional basic information
  about getting started with Wing.
  
* `Tutorial <ref:intro/tutorial>`__ provides a gentler introduction to Wing's features.

* `Wing Reference Manual <ref:manual>`__ documents Wing in detail.

