-
Notifications
You must be signed in to change notification settings - Fork 225
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
Fail for invalid input arguments #256
Comments
This is a great example of why I'm very unhappy with our current way of handling arguments. If we were using normal Python arguments, this typo would have been easily caught by the Python interpreter. Instead, we would have to implement our own argument checking for every single function because of our decorators for input parsing. I'm playing around with ideas for changing this. Mainly having normal keyword Python arguments and translating things inside the Python function. See #262 |
I still have the same issue now and then due to typos. I don't think we can work out a better way handling parameters in the next few releases, but at least we can have a workaround:
I still think this is the easiest workaround. What we should do is add a check at the start of the
here I use |
Description of the problem
We should be more careful to pass unrecognized keyword parameters to gmt command.
Full code that generated the error
The code above is the same as the code on gmt-python's homepage, except that in fig.plot(), I use the keyword
colors
instead ofcolor
. I know it's a user's mistake, but gmt-python reports some strange errors, which is very confusing.Full error message
fig.plot() cannot recognize the keyword
colors
, then pass it directly togmt plot
. Thus the gmt cmd looks likegmt plot ... -colors
, which is a wrong syntax forgmt plot
.For unrecognized keyword parameters, maybe we can pass keyword parameters only if the keyword has a single character, and report other unrecognized parameters to users.
System information
conda list
below:The text was updated successfully, but these errors were encountered: