Select to view content in your preferred language

Disable path consolidation for a single line in code

338
0
11-23-2021 02:52 PM
Status: Open
Thomas_Z2
Regular Contributor

When I publish a Python toolbox and reference a file on the server's file system, I need to register a folder in Data Stores otherwise the file (from my local machine) will be consolidated.

I would like to suggest introducing a mechanism so a developer can force having resources referenced removing the need to register folders. 

It could be as simple as a comment (which the parser will identify) similar to pylint or other tools. Below a quick example:

 

import json
# ...

DATASOURCE_CONFIG_FILE = r"f:\geoportal\data.json"  # esri: disable=consolidate

class Tool(object):
    # ...

    @staticmethod
    def read_datasources():
        """ Read datasource config file. """
        with open(DATASOURCE_CONFIG_FILE, "r") as config_file:
            return json.load(config_file)

 

Links