You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Conan returns: ERROR: Please specify a path to a conanfile or a '--requires=<ref>'
This doesn't happen if I don't have -u in the command. It also doesn't happen if I put the path first: conan lock create path/to/conanfile -r myremote -u
This may apply to all commands. I saw it specifically with conan lock create, but after checking, I saw it happen with conan create as well.
Logs
No response
The text was updated successfully, but these errors were encountered:
I am afraid this is not a bug in Conan, but a limitation in Python argparse and how it handles arguments, something that we cannot fix.
It has affected this particular command in this case because of a small change in 2.1, but to illustrate the behavior this command:
conan create -v .
Failed both in 2.0 and 2.1.
The problem is argparse mostly prints the contextual help with conan create -h in an order that it is not able to process later for all scenarios, printing the mandatory positional arguments last in the short-usage format.
This fails when there are arguments with nargs="?" that can take 0 or more argument.
This is why in the Conan docs we always document and use the usage of positional arguments always first:
conan create . -v # never fails
In your case, the correct command syntax as documented by Conan would be:
We tried in the past to fix the usage output in argparse to avoid this, but it was not easy. We are going to give it another try to avoid this confusion.
Environment details
Steps to reproduce
conan lock create -r myremote -u path/to/conanfile
ERROR: Please specify a path to a conanfile or a '--requires=<ref>'
This doesn't happen if I don't have
-u
in the command. It also doesn't happen if I put the path first:conan lock create path/to/conanfile -r myremote -u
This may apply to all commands. I saw it specifically with
conan lock create
, but after checking, I saw it happen withconan create
as well.Logs
No response
The text was updated successfully, but these errors were encountered: