CMS Snapshot Analysis - Run Analyzer - Python - Information - How to check the syntax validity of a python file

Purpose

This page provides the information about how to use the Python interpreter to check for the syntax validity of a Python file.

For more information, refer to:

Applicable in CAST Version


Release
Yes/No
8.3.x(tick)
Applicable RDBMS


RDBMS
Yes/No
CSS(tick) 
Details

In order to identify whether a Python file is valid or not proceed as follows:

  1. Open a command line from the path where your Python file exist.
  2. Launch Python interpreter from CAST installation folder, <Cast installation folder>\Third-Party\Python34\python.exe , see the below screen shot

  3. Import the python file (for ex: migration.py) which has to be checked (see the screen shot below). Use the command import <python_file_name>

    In the example screen shot above you can see that there is an error "TabError: inconsistent use of tabs and spaces in indentation" which shows that the Python file is not properly interpreted. The interpreter also gives you the line number with the issue.
    This means that you could encounter issues while running the analysis on this file.
  4. When there is no issue with the python file then you will have no error, see below screen shot
Notes/comments


Related Pages