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

MethodError using color kwarg #165

Closed
pdimens opened this issue Jul 22, 2020 · 1 comment · Fixed by #275
Closed

MethodError using color kwarg #165

pdimens opened this issue Jul 22, 2020 · 1 comment · Fixed by #275

Comments

@pdimens
Copy link

pdimens commented Jul 22, 2020

Using ProgressMeter.jl installed from General with ]add ProgressMeter, I'm trying to follow the guide in the README, and attempting to construct a progress bar that is blue, and the code is written:

p = Progress(100, 1, color = :blue)

but it yields the error

ERROR: MethodError: no method matching Progress(::Int64, ::Int64, ::String, ::Int64, ::Symbol, ::Base.TTY; color=:blue)

Closest candidates are:
  Progress(::Integer, ::Real, ::AbstractString, ::Integer, ::Symbol, ::IO; offset) at /home/pdimens/.julia/packages/ProgressMeter/OUQkp/src/ProgressMeter.jl:95 got unsupported keyword argument "color"
  Progress(::Integer, ::Real, ::AbstractString, ::Integer, ::Symbol) at /home/pdimens/.julia/packages/ProgressMeter/OUQkp/src/ProgressMeter.jl:95 got unsupported keyword argument "color"
  Progress(::Integer, ::Real, ::AbstractString, ::Integer) at /home/pdimens/.julia/packages/ProgressMeter/OUQkp/src/ProgressMeter.jl:95 got unsupported keyword argument "color"

However, the docstring seems to also indicate the keyword can be used

help?> Progress
search: Progress progress_map ProgressMeter progress_pmap ProgressThresh ProgressUnknown @showprogress

  prog = Progress(n; dt=0.1, desc="Progress: ", color=:green, output=stderr, barlen=tty_width(desc),
  start=0) creates a progress meter for a task with n iterations or stages starting from start. Output
  will be generated at intervals at least dt seconds apart, and perhaps longer if each iteration takes
  longer than dt. desc is a description of the current task.

Is this a conflict of information between for another release, or perhaps I'm doing something wrong?

@IanButterworth
Copy link
Collaborator

IanButterworth commented Jul 22, 2020

I think that through the addition of new features the method structures have become a little confusing on kwargs.
While Progress(fileSize, 1) is valid Progress(fileSize, 1, color=:blue) isn't.

You can see this from the example in the docstring. What you want should work if you provide dt as a kwarg:

p = Progress(100, dt=1, color = :blue)

There's probably a way to make things clearer, but it may be a breaking change and requires some further thought

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

Successfully merging a pull request may close this issue.

2 participants