I'm following the steps listed on the FAQ page. I have a `data.json` file with some information that I want packaged with the plugin.
- The file's path in the project is `backend\assets\data.json`.
- `backend\setup.py` was modified to include `package_data={...}`.
if __name__ == "__main__":
setup(
name=PACKAGE_NAME,
version=VERSION,
description=SUMMARY,
long_description_content_type="text/markdown",
platforms=["Windows"],
author="Alteryx, Inc.",
author_email="support@alteryx.com",
packages=find_packages(
exclude=["examples", "*.tests", "*.tests.*", "tests.*", "tests"]
),
package_data={
PACKAGE_NAME: [
"assets/*"
]
}
)- backend\ayx_plugins\my_plugin.py attempts to read `data.json` in the `__init__`.
from pathlib import Path
import json
import os
def __init__(self, provider: AMPProviderV2):
self.name = "My Plugin"
self.provider = provider
self.data = json.load(open(Path(os.path.realpath(__file__)).parent / "assets" / "data.json"))> echo y | ayx_plugin_cli designer-install --use-ui --install-type user
However this results in the error
Error: My Plugin (1): Could not init plugin FileNotFoundError(2, 'No such file or directory')
This is because the path it attempts to open is
C:\Users\username\.shiv\main_abcdefg123456789\site-packages\ayx_plugins\assets\data.json
but there is no \assets folder here.