Nicolas Betancourt Cardona
10/03/2024, 4:16 PMcatalog_entry:
type: AnyDataset
filepath: data/01_raw/file.extension
whether on windows or mac. Now I'm having an issue with it for the first time. It turns out that the following catalog entry
problematic_catalog_entry
type: MyCustomDataSet
mainfolderpath: data/01_raw/file.extension
rises a winerror 3 the system cannot find the path specified
when loaded from a Kedro Jupyter Notebook but
problematic_catalog_entry_2
type: MyCustomDataSet
mainfolderpath: C:\same\path\but\absolute\data\01_raw\file.extension
doesn't.
This is absolutely my fault because the data set type I'm using is a custom AbstractDataset
but I don't have this problem with other custom AbstractDataset
. I will attach my _load
method because the problem might be there
def _load(self):
subfolder_names=[ subfolder_name
for subfolder_name in os.listdir(self._mainfolderpath)
if os.path.isdir(os.path.join(self._mainfolderpath, subfolder_name))
]
wav_paths_dict={}
for subfolder_name in subfolder_names:
subfolder_path=os.path.join(self._mainfolderpath, subfolder_name)
wav_files=[]
for root, dirs, files in os.walk(subfolder_path):
for file in files:
if file.lower().endswith('.wav'):
wav_file_path=os.path.join(root, file)
wav_file_name=os.path.split(wav_file_path)[-1].replace('.wav','').replace('.WAV','')
wav_files.append((wav_file_name,wav_file_path))
wav_paths_dict[subfolder_name]=dict(wav_files)
partitioned_dataset_dict={}
for subfolder_name, sub_dict in wav_paths_dict.items():
partitioned_dataset=[(wav_file_name,SoundDataset(wav_file_path).load()) for wav_file_name,wav_file_path in sub_dict.items()]
partitioned_dataset_dict[subfolder_name]=dict(partitioned_dataset)
return partitioned_dataset_dict
On __init__
I'm initializing self._mainfolderpath
this way: self._mainfolderpath = PurePosixPath(mainfolderpath)
. Thank you very much for yor help againNok Lam Chan
10/03/2024, 4:23 PMNok Lam Chan
10/03/2024, 4:27 PMwinerror 3 the system cannot find the path specified
when loaded from a Kedro Jupyter Notebook but
Which lines of code give you this error? You should be able to tell from the stacktrace, or simply print out the path.Nicolas Betancourt Cardona
10/03/2024, 4:32 PMcatalog.load('problematic_catalog_entry')
in a kedro jupyter notebook (this is the catalog entry with the relative path). Meanwhile the line catalog.load('problematic_catalog_entry_2')
do not rises an error.
I just ran kedro run --node test_node
from my terminal, where test_node has problematic_catalog_entry
as input and it does not rises an error. This is the same catalog entry that rises an error on jjupyterNok Lam Chan
10/03/2024, 4:33 PM%load_ext kedro.ipython
, that should load up a global catalog
for you.Nicolas Betancourt Cardona
10/03/2024, 4:35 PMNok Lam Chan
10/03/2024, 4:38 PMNicolas Betancourt Cardona
10/03/2024, 4:38 PMos.chdir("/path/to/kedro/project")
fixed the problemNok Lam Chan
10/03/2024, 4:39 PMNok Lam Chan
10/03/2024, 4:40 PMNok Lam Chan
10/03/2024, 4:41 PMconf_keys_with_filepath = ("filename", "filepath", "path")
But in your case the conversion didn't happen. So you will likely have to handle that yourself.Nok Lam Chan
10/03/2024, 4:42 PMNicolas Betancourt Cardona
10/03/2024, 4:46 PM