Tutorial: Setting Python Path

Whenever your Python source depends on PYTHONPATH, either set externally
or by altering sys.path at runtime, you will also need to tell Wing
about your path.

This value can be entered in Python Path in the
ProjectProperties dialog, which is accessible from the Project
menu and the toolbar:

For this tutorial, you need to add the subdir sub-directory of your
tutorials directory to PythonPath, as shown above. This directory
contains a module used as part of the first coding example.

Note that the full path to the directory subdir is used. This is strongly
recommended because it avoids potential problems finding source code when
the starting directory is ambiguous or changes over time.
If relative paths are needed to make a project work on different machines,
use an environment variable like ${WING:PROJECT_DIR}/subdir. This is
described in more detail in Environment Variable Expansion.

The configuration used here is for illustrative purposes only. You could run
the example code without altering PYTHONPATH by moving the
path_example.py file to the same location as the example scripts, or by
placing it into your Python installation's site-packages directory, which
is in the default PYTHONPATH.

Python Path Hints

If your main entry point is Python code that alters sys.path, and the
file is set as the MainEntryPoint in ProjectProperties then Wing can
often determine the correct PYTHONPATH to use without any changes to
PythonPath in ProjectProperties.

When in doubt, compare value of sys.path at runtime in your code with the
value reported by Show Python Environment in the Source menu.