问题
Today is my first day trying out Google Prediction API on Anaconda Python (Ubuntu Linux).
I wanted to try out the Hello Prediction starter code prediction.py using the following:
$ python prediction.py --object_name="mymodelid/mybucket" --id="myidentifier"
exactly how it is advised in the code documentation.
However, I am getting the following error:
usage: pred.py [-h] [--auth_host_name AUTH_HOST_NAME]
[--noauth_local_webserver]
[--auth_host_port [AUTH_HOST_PORT [AUTH_HOST_PORT ...]]]
[--logging_level {DEBUG,INFO,WARNING,ERROR,CRITICAL}]
object_name id
pred.py: error: too few arguments
I've tried debugging, but I get lost within the argparse
package methods.
Any help is much appreciated.
EDIT: Prerequisites to reproduction of this code include uploading data to Google Storage. Steps can be found here.
回答1:
According to the error message you should be using
$ python prediction.py mymodelid/mybucket myidentifier
It expects 2 strings, without flags.
usage: pred.py [-h] [--auth_host_name AUTH_HOST_NAME]
...
object_name id
You can also include values like '--auth_host_hame=Joe', but that's in []
, so is optional. There isn't an '[--id ID]' term in the usage line.
来源:https://stackoverflow.com/questions/30638974/google-prediction-api-hello-prediction-error-too-few-arguments