class ExtractData:
def __init__(self):
self.kaggle_api = KaggleApi()
self.script_dir = os.path.dirname(os.path.abspath(__file__))
self.data_dir = os.path.join(self.script_dir,'..','data')
self.download_dir = os.path.abspath(self.data_dir)
os.environ['KAGGLE_CONFIG_DIR'] = os.path.join(self.script_dir,".kaggle")
# This will call kaggle api, perform authentication and download data in Data directory
def download_dataset(self,dataset_name):
self.kaggle_api.authenticate()
self.kaggle_api.dataset_download_files(dataset_name, path=self.download_dir, unzip=True)
./opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/multiprocessing/pool.py:265: ResourceWarning: unclosed running multiprocessing pool <multiprocessing.pool.ThreadPool state=RUN pool_size=4>
_warn(f”unclosed running multiprocessing pool {self!r}”,
ResourceWarning: Enable tracemalloc to get the object allocation traceback
Running this code using Github Action workflow for my project but I am keep on getting this exception, I tried few things but not all. KaggleAPI doesn’t have explicit function to close api call after use
AKASH YADAV is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.