If the brute force approach previously described does not work or appeal to you, the steps below will walk you through the process to figure out more explicitly which imports are required.

Steps:

  1. Go to Scripts -> Editor… and then select the script of interest from the tree.


  2. Comment out the wildcard import line(s), one at a time. (In CWMS scripting, this can be done by placing a "#" at the start of the line). One line at a time.

NOTE: By commenting out one line at a time, if you get an error when you try to run the script (as the next instruction will ask you to do), then you will know what package the class or class member that triggered the error belongs to - it's the package identified after the "from" keyword in the import statement you commented out.
The ultimate objective is to remove ALL


  1. "Save/Run" the script in the script editor and see if the script fails. If it does not fail, then the import line you commented out was unnecessary and can be deleted from the script.
  2. However, if the script fails, make note of the error message and what line the scripts fail at.


  3. The error should tell you that something is undefined. You will use this error to search the JavaDocs that are supplied with CWMS/HEC-RTS to find the class that is needed on the import line. The JavaDocs provide the most authoritative information regarding the CWMS Java API.  In addition, the Script Editors in CWMS, CWMSVue, DSSVue, and ResSim include a tree structure that lists the major packages in the CWMS Java API that might be useful in your scripts.
    1. Open a file browser and locate the CWMS installation folder then browse to the CAVI/JavaDocs folder within the CAVI installation.
    2. Double-click on the "index.html" file. This will launch your default web browser and display the index of the CWMS JavaDocs.

    3. Select the “INDEX” option at the top of the main viewing window.


    4. Optional - You can go to the script editor in the CAVI and select a folder within the API tree and press "F1" on your keyboard to open the JavaDocs within the CAVI.
  4. From the JavaDocs index, use "ctrl"+ f to access the find function. Enter the name of the object or method that is undefined and click
    1. Doing this will highlight the text on the page and the user can scroll through the options.


  5. Go through and figure out what class this is from
    1. When the user is scrolling through the find function, one of these will be the class being used.
    2. If the find function finds something in the left pane in the list of classes, this should be a good start compared to the options shown in the index.



  1. Now, uncomment the "import from hec.script import *" line in your script and replace the * with the name of the class you identified.


  2. Select "Save/Run" and see if the script runs successfully.
    1. Some items have potential to be denoted in multiple classes but one of them should align with one of the wildcard imports in your script. If it happens to fall within multiple ones, use trial and error to get the line to run.
    2. It is also possible that multiple classes will need to be imported per package. In the example, only MessageBox needed to be imported from hec.script.  For example, lets say that the class HecDss was used by the script which is a class of hec.script, the user could write the import as “from hec.script import MessageBox, HecDss” and this would import both classes from the hec.script package.
  3. If the “Save/Run” runs successfully, the user can comment out the next wildcard import and repeat the steps

NOTE: Not using Wildcard imports should improve the scripts processing speed since it is not being told to look for and add items the script will not use.


If you are still having issues with scripts, please feel free to contact any of the below people.

Alex DavisAlexander.J.Davis@usace.army.mil(530) 302-3723
Fauwaz HanbaliFauwaz.Hanbali@usace.army.mil(530) 302-3712
Joan KlipschJoan.Klipsch@usace.army.mil(530) 302-3724
Karl TarbetKarl.L.Tarbet@usace.army.mil(530) 302-3725
Eric TichanskyEric.M.Tichansky@usace.army.mil(530) 302-3716
Russell ErrettRussell.J.Errett@usace.army.mil(314) 331-8337
Alex FlaniganAlexander.J.Flanigan@usace.army.mil(402) 995-2315
Mohammad IslamMohammad.S.Islam@usace.army.mil(409) 766-3084
Ryan LarsenRyan.J.Larsen@usace.army.mil(402) 996-3861