Setting Up PyCharm for Debugging Waf
Setting Up PyCharm for Debugging Waf
| AZ Code Generator is in preview release and is subject to change. |
PyCharm is an integrated development environment for Python which includes a graphical debugger that is useful for debugging Waf.
To set up PyCharm and Waf for debugging
Download PyCharm Community Edition .
Start PyCharm.
At the welcome screen, choose Open Directory.
Navigate to the
lumberyard_version\devdirectory. There should be a file calledwscriptandwaf_branch_spec.pyunder this folder.Configure the Python interpreter.
Choose File, Settings, Project:dev, Project Interpreter to open the project interpreter page.
Click the gear
icon on the right of the Project Interpreter and choose Add....
Select the Existing environment radio button, and then click the ellipsis \(**\.\.\.**\) icon to the right of it.

Navigate to the folder containing the
pythonexecutable. The executable will be contained under the pathlumberyard_version\dev\Tools\Python\3.7.5\platform, with the exact path depending on your platform. The Python executable file must be in the same folder as the project or you may have issues running Waf.
Set up a debugging profile for Waf.
To set up Waf for debugging, use the project explorer in the left pane. If you don’t see the project explorer, press Alt+1). Navigate to the
\dev\Tools\Build\waf-<version>node and expand it. You should see a file calledlmbr_wafinside this node.
Right-click lmbr_waf and choose Create lmbr_waf Note
The Indexing... operation must finish before the option appears. You can verify status in the bar at the bottom.
In the Create Run/Debug Configuration dialog, ensure that the following values are configured correctly:
- Allow parallel run should be unselected.
- Parameters is the command to use to run Waf for the run/debug session.
- Python Interpreter should be the interpreter that you specified earlier.
- The Working directory must be the
devdirectory.
Set up
wscriptfiles as debuggable Python files. Waf uses files calledwscriptto define the build rules per project. These are dynamically loaded Python modules that can be debugged like any other Python module.Choose File, Settings, Editor, File Types.
Choose Python in Recognized File Types. Select the + icon to the right of the Registered patterns section to add a new file type.
![[]](http://docs.aws.amazon.com/lumberyard/latest/userguide/images/codegen/az-code-gen-pycharm-6.png)
Under Registered Patterns, click the green plus sign \(**\+**\).
In the Add Wildcard dialog box, enter wscript.

Turn off IncrediBuild.
Open the
_WAF_/usersettings.optionsfile.Verify that
use_incredibuild = False
\(Optional\) Enable file outlining. This feature makes it easier to navigate source files.
To enable file outlining, right-click the Project tab and choose Show Members.