Dies ist eine alte Version des Dokuments!


Python Scripting for VEGAS Pro

Python Script Features

Debugging of Scripts with Visual Studio 2017

The interactive VEGASPython Window is only foreseen for very short scripts needing a few lines. For longer scripts it is proposed to use a Python Script Editor that supports the writing of Python code. But this is not all. It is very unusual that the script you have written is working correctly from the start. There are always small things that are wrong - especially simple typos or logical flow errors.

As PYTHON is an interpreted language, most erros can only be found when the script is executed.

This seems to be a disadvantage. But: Due to the interpretation of the script at runtime the turn arround times frem chnaging the script to seeing the results or error is much faster than in other languages.

Especially the startup time of VEGAS and opening a test project can take a lot of time.

With VEGASPython, Vegas stays open with the test project all the time. You only have to restart the script for testing after you updated it.

It may be surprising but the best support for VEGASPython editing and debugging is provided by Microsoft Visual Studio 2017 (this is the current version). You can use the free community version of Visual Studio 2017. And with Python you can use Visual Studio as a simple editor and debugger. You do not have to deal with all the other complex development project setups.

Visual Studio Installation

Here is what you have to do to setup your editing system for VEGASPython:

  1. Download Microsoft Visual Studio 2017 community edition: https://visualstudio.microsoft.com/de/downloads/
  2. Install Visual Studio
  3. When the Installer asks: which development invironment should be installed? - select „Python“ (if you want to use other environemnts too, feel free to add them)
  4. Take for all other questions the standard answer

Editing Python Files with Visual Studio

Open Visual Studio

A Window like the following one will open:

If you are not familiar with Visual Studio, this start page may overload you. With Python you do not have to bother with creating a project and define all the parameters. We will use Visual Stduio only as an Editor.

So the only step we are doing: We go to the „File“ Menu and open an exsting Python file or create a new Python file.

In this example we select the file test.py that is located in the sub-directory „test“ of the VEGASPython directory.

After opening the file, you can edit the file now in the Visual Studio Editor.

Debugging Python Files with Visual Studio

Visual Studio can do much more for us that only editing the script. You can set breakpoints at every line of the script.


Andere Sprachen
QR-Code
QR-Code en:debugging_of_scripts_with_visual_studio_2017 (erstellt für aktuelle Seite)