Navigation

Previous topic

Setting up paths for unix (any flavor; “not Windows”)

Next topic

Additional Python functionality

This Page

Windows paths and environment variables

Suppose (for example) all the CODAS programs were extracted into c:\w\programs. You need to

  1. change three environment variables
  2. set up your matlab path
  3. verify that “.py” file extenstion is associated with Python

These instructions use the Control Panel to set these variables. On a recent Windows XP installation no reboot was necessary after making the changes, but rebooting (or at least calling up a new C-prompt window) may be required.

(1) ENVIRONMENT VARIABLES

To change these using Windows tools, as administrator, go to Settings : Control Panel : System : Advanced : Environment Variables and edit the following two entries.

Note

These paths are delimited by seicolons.

The environment variables to alter are:

  1. PATH (modify) allows the command line to find the program without the full path). This will include executables and the python program itself

    ** add these to PATH**

    • c:\w\programs\codas3\bin\win32 (for executables)
    • c:\w\programs\pycurrents\adcp (for .py scripts)
    • c:\w\programs\pycurrents\data\nmea (NMEA parsing programs)
  2. PYTHONPATH (new variable) allows python to find the modules it needs to load

    ** create a new variable called PYTHONPATH with this entry**

    • c:\w\programs

(2) MATLAB PATH

You should also go into your matlab path editor and add

c:\w\programs\matlab

(the path to the UH programs directory) to the path, and save it. Any time you run matlab programs you should type “adcppath; radcppath” to add the appropriate programs to your path. Alternatively, run the commands once, then go to “Set Path” and “Save”.

IMPORTANT: See this link for more information about the mex file “table1” we use for linear interpolation. This is important to get right and becomes more difficult with each new matlab release.

Any time you are going to run CODAS matlab code, type the following first to add the specific paths that are used.

  • adcppath; radcppath; mexpath

(3) Python File association

Make sure the “properties” of a python files (\*.py) are associated with c:\python25\python.exe (whatever your python executable is). ActiveState Python sets this up automatically. I have not tested python.org.

  • Open the folder C:\w\programs\pycurrents\adcp in Windows Explorer

  • Right-click “quick_adcp.py” and verify that the default item in “Open With” is Python.

  • If it is not, click “Open With” to choose the program that you want.

  • Click “Choose Program...” to choose the program you want.

  • Browse to your Python installation (eg. C:\Python25) and click on Python.exe

  • Select the “Always use the selected program” to open this kind of file check box if it is not selected. Click OK.

    Note From now on, Windows XP will open all files that have this file name extension in the program that you selected. To change this, you must follow these steps again and associate a different program with this file name extension.

NOTES AND HINTS

  • DO NOT add any subdirectories of PROGRAMS/matlab (if using the path tool in matlab, do not add the PROGRAMS/matlab diretory recursively); only add the directory itself.
  • The path to your PROGRAMS directory may be quite long. You can create a network share of the folder (recommend “read only”, and then “map network drive”) and assign the folder a drive letter (such as “P”). Then the above PATH and PYTHONPATH description would use “P:\programs” instead of “C:\w\programs”.