0

I am following the OCR tutorial on Google Cloud website (https://cloud.google.com/functions/docs/tutorials/ocr?hl=en_GB#functions-prepare-environment-python), however, I can't deploy the image processing function.This is the command I ran:

gcloud functions deploy ocr-extract \
--runtime python39 \
--trigger-bucket YOUR_IMAGE_BUCKET_NAME \
--entry-point process_image \
--set-env-vars "^:^GCP_PROJECT=YOUR_GCP_PROJECT_ID:TRANSLATE_TOPIC=YOUR_TRANSLATE_TOPIC_NAME:RESULT_TOPIC=YOUR_RESULT_TOPIC_NAME:TO_LANG=es,en,fr,ja"

The errors I get are:

ERROR: (gcloud.functions.deploy) unrecognized arguments: \

To search the help text of gcloud commands, run:
  gcloud help -- SEARCH_TERMS

'--runtime' is not recognized as an internal or external command,
operable program or batch file.

'--trigger-bucket' is not recognized as an internal or external command,
operable program or batch file.

'--entry-point' is not recognized as an internal or external command,
operable program or batch file.

'--set-env-vars' is not recognized as an internal or external command,
operable program or batch file.

Does anyone know how to solve this? Any help would be appreciated!

Nina
  • 499
  • 6
  • 16
  • Are you executing the command in CMD? – Fran Arenas Sep 02 '21 at 19:35
  • Yes, I'm running in CMD in python virtual environment in the directory of sample code that is provided by google (https://github.com/GoogleCloudPlatform/python-docs-samples/tree/master/functions/ocr/app) – Nina Sep 02 '21 at 20:19
  • Try the command without the '\' character, for some reason the error message seems to say that your cmd is recognizing '\' as a parameter – Fran Arenas Sep 02 '21 at 20:31

1 Answers1

1

The example provided is linux/unix oriented and it uses the continuation character \ for issuing multiline commands, but you are very likely running the command in windows.

If that is the case, please, try providing the whole command in a single line or use an equivalent continuation character: this SO question provides several alternatives for using multiline command in different windows versions, in cmd and Powershell, in summary, as pointed out as well by @TimRoberts in his comment, you can use the caret ^ command in cmd or the back tick ` in Powershell.

jccampanero
  • 50,989
  • 3
  • 20
  • 49
  • 1
    For future reference, the equivalent character for command continuation on Windows is the caret `^` . This is not terribly well-known. – Tim Roberts Sep 02 '21 at 21:59
  • Thank you very much @TimRoberts. The mentioned SO question indicates that as well, but you are right, it is of great value to provide the information directly in the answer. Thanks again. – jccampanero Sep 02 '21 at 22:02
  • Thanks! It works when I insert the caret ^ instead of the continuation character \. – Nina Sep 03 '21 at 07:30
  • You are welcome @Nina, I am happy to hear that it worked properly. – jccampanero Sep 03 '21 at 13:27