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

World Age issue #33

Open
Arkoniak opened this issue Feb 26, 2021 · 0 comments
Open

World Age issue #33

Arkoniak opened this issue Feb 26, 2021 · 0 comments

Comments

@Arkoniak
Copy link
Owner

module InitializeGlass
using UrlDownload

function downloadcatalogs(glassdirectory::String)
    catalogs = ("https://www.nikon.com/products/optical-glass/assets/pdf/nikon_zemax_data.zip", 
    "https://www.oharacorp.com/xls/OHARA_201130_CATALOG.zip", 
    "https://hoyaoptics.com/wp-content/uploads/2019/10/HOYA20170401.zip")

    getzip(url)  = urldownload(url,compress = :zip, parser = identity)

    @info glassdirectory

    for url in catalogs
        # try
            zipcat = getzip(url)
            filename = replace(zipcat.name, r"""[ ,.:;?!()&-]""" => "_")
            filename = replace(filename, "_agf" => ".agf")
            filename = replace(filename, "_AGF" => ".agf")
            temp = read(zipcat,String)
            catname = joinpath(glassdirectory,filename)
            @info "writing $catname"
            write(joinpath(glassdirectory,filename),temp)
        # catch err
        #     continue #if download fails for any reason continue to the next catalog
        # end     
    end
end

downloadcatalogs(ARGS[1])

end #module

When executed from the terminal

julia --project=. test.jl ./

produces error

ERROR: LoadError: MethodError: no method matching eof(::ZipFile.ReadableFile)
The applicable method may be too new: running in world age 29850, while current world is 29852.
Closest candidates are:
  eof(::ZipFile.ReadableFile) at /home/skoffer/.julia/packages/ZipFile/fdYkP/src/ZipFile.jl:533 (method too new to be called from this world context.)
  eof(::Base.AbstractPipe) at io.jl:416
  eof(::HTTP.WebSockets.WebSocket) at /home/skoffer/.julia/packages/HTTP/cxgat/src/WebSockets.jl:251
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant