Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


AWRDE is a COM automation server and any programming language that can perform as a COM client can be used. This includes Python. With Python you will need to install the win32com.client library.

Installing win32com (pypiwin32)

Note it is recommended that you use Python version 3.7 or later with AWRDE although earlier versions may work.


Code Block
pip install pypiwin32

titlesample console session...

Code Block
dane@PC-DANE C:\Python38\Scripts                                       
> .\pip install pypiwin32                                              
Collecting pypiwin32                                                   
  Using cached
Collecting pywin32>=223 (from pypiwin32)                               
     |████████████████████████████████| 9.3MB 6.4MB/s                  
Installing collected packages: pywin32, pypiwin32                      
Successfully installed pypiwin32-223 pywin32-300                       

This will install the package into your library.  Once this is done the type library for AWRDE must be build.  This is done by running the script.

 In a command prompt, perform the following...

Code Block
cd [python libinstall directory]/\Lib\site-packages/\win32com/\client

When prompted select the "AWR Microwave Office V15 15 (1.0)" entry in the menu. This script will then create a set of definitions that will be loaded automatically when you connect to AWRDE.

titlesample console session...

Code Block
dane@PC-DANE C:\Python38\Lib\site-packages\win32com\client
> python
Generating to C:\Users\dane\AppData\Local\Temp\gen_py\3.8\
Building definitions from type library...
Importing module

Testing your installation


Code Block
# Simple script to test win32com installation
import win32com.client
awrde = win32com.client.Dispatch('AWR.MWOffice')  # connect to AWRDE, load AWRDE types
for model in awrde.Models:

Raw Connections

Connecting to a Specific Version of AWRDE


First, in the AWR Design Environment, you need to go into the VB scripting and run


to get the CLSID of the instance you want to connect to. This will be something like:


Then, from within python, you use:


Note the braces are required. 

Connecting with pyawr

The pywin32 package contains everything needed to connect to AWRDE from Python but since Python is not a strongly typed language, editors do not have the information they need to provide advanced functionality such as IntelliSense.  To solve this problem, AWR has created an interface layer on top of win32com which add the type information for the AWR COM interface.  With this interface, editors such as Visual Studio Code (using the Visual Studio IntelliCode and Pylance plugins), can provide type hints.

The pyawr package is available at:  See the README for instructions on installation.

Using pyawr

When using the API wrapper layer, connecting to AWRDE will be done a little differently.  To connect use the CMWOffice class.

Code Block
import pyawr.mwoffice as mwo
awrde = mwo.CMWOffice()

This will create an object of type pyawr.mwoffice.CMWOffice which has type information defined for it.

Helper Functions

pyawr also contains some helper functions which we have found quite useful when using python.  The include:

  • connect() - a simple way to connect to AWRDE
  • open_example() - a function to open any of the standard examples in the installer
  • vbrange() - a function which returns a VB style index range.  For example vbrange(2) returns 1, 2 (vb indexes start at 1 rather than 0)
  • as_list() - a function which takes a VB collection and enumerates it into a list
  • meas_from_graph() - returns the measurement objects in a graph
  • class AwrMeas - returns an object from an MWO measurement including a pandas DataFrame of the data