-1

I have created a python package and I need to have np.load('./my_file.npy') in my package. when I install package and run the code the path is not correct and python cannot find the file

I tried the following code as well

dirname = Path(__file__).parent
path = dirname / 'my_file.npy'
np.load(str(path))

In pyproject.toml file I have as well

[tool.flit.sdist]
include = [
    "my_file.npy",
]
WebMaster
  • 3,050
  • 4
  • 25
  • 77

1 Answers1

1

Do I understand you correctly that you want to include the file my_file.npy in your package using flit?

Flit‘s docs about data files: https://flit.pypa.io/en/stable/pyproject_toml.html?highlight=Data#external-data-section

I have nothing special in my toml file and it includes my data files in the package.

mokko
  • 186
  • 9