Email Data Feed - Invalid Escape Error
search cancel

Email Data Feed - Invalid Escape Error

book

Article ID: 172914

calendar_today

Updated On:

Products

Email Security.cloud Email Threat Detection and Response

Issue/Introduction

Log files are not being generated when running the Python script on a Windows system.

ValueError: Invalid \escape: line 7 column 32  (char 260)

Environment

Advanced Threat Protection Email 

Cause

The Python configuration file (NdfConfig.json) is missing an extra slash “\”  in the cookies and log file path 

cookiesFilePath line is used to specify the path at which to store the persistent cookies that are used to mark your place in the feed.
logsFilePath line is used to specify the path at which to store the log files that the Data Feeds API connection session produces.

Resolution

In a Windows environment, you must escape the slash in order for the Python script to run, otherwise the script will treat it as a special character. The file path can include multiple sub directories but the slash needs to be escaped e.g., C:\\directory\\sub_directory

 

Incorrect path:

        "cookiesFilePath" : "C:\datafeed\cookies",

        "logsFilePath" : "C:\datafeed\logs"

 

Correct path:

        "cookiesFilePath" : "C:\\datafeed\\cookies",

        "logsFilePath" : "C:\\datafeed\\logs"

 

The following table describes the characters that need to be escaped in python:  https://docs.python.org/2.0/ref/strings.html