anyflights icon indicating copy to clipboard operation
anyflights copied to clipboard

Issue running anyflights() function cannot open file at get_planes()

Open Colleca opened this issue 11 months ago • 3 comments

Hello, running into an issue trying out the anyflights() function. Opened a fresh renv project with only this package and dependents installed. I believe based on the status messages its in the get_planes() part of the function.

Image

For fun I also tried making a folder called "flights_data" in the project and writing to it. Frustratingly I can see the file does exist but it says it cant open it, weird.

Image

It exists:

Image

Colleca avatar Jan 20 '25 06:01 Colleca

Hm, interesting. Could you run this code and paste the results here?

# if needed:
# install.packages("reprex")

reprex::reprex({
tempfile <- tempfile()
writeLines("This is a test line", tempfile)

zip_tempfile <- tempfile(fileext = ".zip")
zip(zip_tempfile, files = tempfile)
unzip(zip_tempfile)
})

simonpcouch avatar Jan 22 '25 00:01 simonpcouch

there was no output so i added the print line. when i run it outside of reprex in console i get this instead

Image

tempfile <- tempfile()
writeLines("This is a test line", tempfile)

zip_tempfile <- tempfile(fileext = ".zip")
zip(zip_tempfile, files = tempfile)
unzip(zip_tempfile)
print("do something")
#> [1] "do something"

Created on 2025-01-22 with reprex v2.1.1

Colleca avatar Jan 22 '25 05:01 Colleca

It seems the issue is that

  planes_src <- paste0(
    "http://registry.faa.gov/database/yearly/ReleasableAircraft.", 
    year, 
    ".zip"
  )

in get_planes_data() now automatically reroutes to https://www.faa.gov/about/office_org/headquarters_offices/avs/offices/afx/afb/afb700 . The get_planes() help refers to this page https://www.faa.gov/licenses_certificates/aircraft_certification/aircraft_registry/releasable_aircraft_download and it looks like the "Download the Aircraft Registration Database (60MB)" link there to https://registry.faa.gov/database/ReleasableAircraft.zip does work. I'm testing to see if that file is in the same format as the yearly data to see if the fix can be to download that file instead and forget about year.

ismayc avatar May 06 '25 19:05 ismayc