Skip to content

Commit c5bbdfd

Browse files
authored
Fix incorrect parameter name (GoogleCloudPlatform#4906)
* Fixes the problem with incorrect parameter name ## Description Fixes GoogleCloudPlatform#4905 <!-- Please be specific. Copying and pasting your invocation and the entire output is often helpful. --> > File "/user_code/main.py", line 42, in detect_text text_detection_response = vision_client.text_detection(source=image) TypeError: inner() missing 1 required positional argument: 'image' I got this error message when I followed the tutorial https://cloud.google.com/functions/docs/tutorials/ocr#functions-clone-sample-repository-python <!-- Please provide the full path to the file, to avoid ambiguity --> ` /functions/ocr/app/main.py, line 42 ` <!-- A diff would be helpful; otherwise, a description --> ``` text_detection_response = vision_client.text_detection(image=image) ``` change parameter name "source" => "image" ## Checklist - [ ] I have followed [Sample Guidelines from AUTHORING_GUIDE.MD](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/AUTHORING_GUIDE.md) - [ ] README is updated to include [all relevant information](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/AUTHORING_GUIDE.md#readme-file) - [ ] **Tests** pass: `nox -s py-3.6` (see [Test Environment Setup](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/AUTHORING_GUIDE.md#test-environment-setup)) - [ ] **Lint** pass: `nox -s lint` (see [Test Environment Setup](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/AUTHORING_GUIDE.md#test-environment-setup)) - [ ] These samples need a new **API enabled** in testing projects to pass (let us know which ones) - [ ] These samples need a new/updated **env vars** in testing projects set to pass (let us know which ones) - [ ] Please **merge** this PR for me once it is approved. - [ ] This sample adds a new sample directory, and I updated the [CODEOWNERS file](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/.github/CODEOWNERS) with the codeowners for this sample
1 parent 9d6c377 commit c5bbdfd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

functions/ocr/app/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def detect_text(bucket, filename):
3939
image = vision.Image(
4040
source=vision.ImageSource(gcs_image_uri=f"gs://{bucket}/{filename}")
4141
)
42-
text_detection_response = vision_client.text_detection(source=image)
42+
text_detection_response = vision_client.text_detection(image=image)
4343
annotations = text_detection_response.text_annotations
4444
if len(annotations) > 0:
4545
text = annotations[0].description

0 commit comments

Comments
 (0)