Skip to content

World Age issue #33

@Arkoniak

Description

@Arkoniak
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions