I’m using tarfile library of python to untar the tarball, but getting error file not found, although the file exists at the location.
Also, im able to untar the file locally using below command –
tar -xvf filename.tar.tz
Below is the error I’m facing –
Traceback (most recent call last):
File "/axp/rim/aidadeploy/app/envs/airflow_e2_2023_04_06/lib/python3.7/site-
packages/airflow/operators/python.py", line 175, in execute
return_value = self.execute_callable()
File "/axp/rim/aidadeploy/app/envs/airflow_e2_2023_04_06/lib/python3.7/site-
packages/airflow/operators/python.py", line 193, in execute_callable
return self.python_callable(*self.op_args, **self.op_kwargs)
File "/axp/rim/aidadeploy/warehouse/airflow_e2/dags/aida-deploy-
dag/aida_deploy_maas_cas_untar_uat_file_dag.py", line 46, in
untar_and_delete_uat_file
file = tarfile.open(filePathToUnTar)
File "/opt/python/python37/lib/python3.7/tarfile.py", line 1575, in open
return func(name, "r", fileobj, **kwargs)
File "/opt/python/python37/lib/python3.7/tarfile.py", line 1639, in gzopen
fileobj = GzipFile(name, mode + "b", compresslevel, fileobj)
File "/opt/python/python37/lib/python3.7/gzip.py", line 168, in __init__
fileobj = self.myfileobj = builtins.open(filename, mode or 'rb')
Below is the sample code I’ve written –
file = tarfile.open(filePathToUnTar)
path_extract_to = file_path(context)
print("file to untar: ", filePathToUnTar)
4