Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileNotFoundError: [WinError 3] The system cannot find the path specified #1407

Open
gemyasser opened this issue Nov 20, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@gemyasser
Copy link

from eodag import EODataAccessGateway
from shapely.geometry import shape
import json
import logging
from pathlib import Path


# logging.basicConfig(level=logging.DEBUG)


def search_and_download_sentinel2(geojson_path, start_date, end_date, max_results=100, output_dir="downloads"):
    dag = EODataAccessGateway()
    dag.set_preferred_provider("creodias_s3")  


    with open(geojson_path, 'r') as f:
        geojson = json.load(f)
        aoi = shape(geojson["features"][0]["geometry"])
        print(aoi)

    search_results = dag.search(
        productType="S3_OLCI_L2LFR",  
        start=start_date,
        end=end_date,
        geom=aoi,
        items_per_page=max_results,
    )

    print(f"Found {len(search_results)} products.")

    for product in search_results:
        print(f"Downloading: {product.properties['title']}")
        dag.download(product, output_dir=output_dir)

search_and_download_sentinel2(
    geojson_path= "AOIs/med_res_sat_SUD.geojson",
    start_date="2023-01-01",
    end_date="2023-01-05",
    output_dir= r"F:\codes\sat Download\dataDownloaded\Sentinel-2"
)

Output

POLYGON ((32.20912518264985 16.001429600946867, 30.67994019716005 9.026086536531599, 33.283233091746496 9.023104392667678, 34.90623769472232 15.99810196896443, 32.20912518264985 16.001429600946867))
Found 16 products.
Downloading: S3B_OL_2_LFR____20230101T074319_20230101T074619_20230101T094239_0179_074_263_2700_PS2_O_NR_002.SEN3
Traceback (most recent call last):0230101T074619_20230101T094239_0179_074_263_2700_PS2_O_NR_002: 0%| | 0.00/165M [00:00<?, ?B/s]
File "f:\codes\sat Download\downloadData_CoPla.py", line 35, in
search_and_download_sentinel2(
File "f:\codes\sat Download\downloadData_CoPla.py", line 33, in search_and_download_sentinel2
dag.download(product, output_dir=output_dir)
File "C:\Users\mohamed.yasser.conda\envs\yasser\Lib\site-packages\eodag\api\core.py", line 2257, in download
path = product.download(
^^^^^^^^^^^^^^^^^
File "C:\Users\mohamed.yasser.conda\envs\yasser\Lib\site-packages\eodag\api\product_product.py", line 328, in download
fs_path = self.downloader.download(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\mohamed.yasser.conda\envs\yasser\Lib\site-packages\eodag\plugins\download\aws.py", line 369, in download
os.makedirs(chunk_abs_path_dir)
File "", line 225, in makedirs
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'F:\codes\sat Download\dataDownloaded\Sentinel-2\S3B_OL_2_LFR____20230101T074319_20230101T074619_20230101T094239_0179_074_263_2700_PS2_O_NR_002.SEN3\Sentinel-3/OLCI/OL_2_LFR/2023/01/01/S3B_OL_2_LFR____20230101T074319_20230101T074619_20230101T094239_0179_074_263_2700_PS2_O_NR_002.SEN3'
S3B_OL_2_LFR____20230101T074319_20230101T074619_20230101T094239_0179_074_263_2700_PS2_O_NR_002: 0%| | 0.00/165M [00:00<?, ?B/s]

Environment:

  • Python version: 3.11.9
  • EODAG version: 3.0.1
@gemyasser gemyasser added the bug Something isn't working label Nov 20, 2024
@sbrunato
Copy link
Collaborator

sbrunato commented Nov 20, 2024

Hello @gemyasser , and thanks for pointing out this issue.
We can see that F:\codes\sat Download\dataDownloaded\Sentinel-2\S3B_OL_2_LFR____20230101T074319_20230101T074619_20230101T094239_0179_074_263_2700_PS2_O_NR_002.SEN3\Sentinel-3/OLCI/OL_2_LFR/2023/01/01/S3B_OL_2_LFR____20230101T074319_20230101T074619_20230101T094239_0179_074_263_2700_PS2_O_NR_002.SEN3 is malformed : there are / instead of \ in the path.

Notes to fix this issue:

  • AwsDownload.get_chunk_dest_path() must be fixed to return OS-independant paths
  • also fix re.sub(rf"^{common_path}/?", "", chunk_rel_path), regex in AwsDownload.get_chunk_parts()
  • test it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants