Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Issue with running the v3 version of the API..getting an error #62

@rajatgupta143

Description

@rajatgupta143

Thanks for stopping by to let us know something could be better!

PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.

Please run down the following list and make sure you've tried the usual "quick fixes":

If you are still having issues, please be sure to include as much information as possible:

Environment details

  • OS type and version: AI Notebook, Python 3.7
  • Python version: python --version : Python 3.7
  • pip version: pip --version: pip 20.1.1 from /opt/conda/lib/python3.7/site-packages/pip (python 3.7)
  • google-cloud-documentai version: pip show google-cloud-documentai: jupyter@python-20200630-170900:~$ pip show google-cloud-documentai
    Name: google-cloud-documentai
    Version: 0.3.0
    Summary: UNKNOWN
    Home-page: https://github.com/googleapis/python-documentai
    Author: Google LLC
    Author-email: googleapis-packages@google.com
    License: Apache 2.0
    Location: /opt/conda/lib/python3.7/site-packages
    Requires: google-api-core, proto-plus
    Required-by:

Steps to reproduce

  1. I am trying to run the OOTB code shared for batch processing of the invoices. Here is the sample call that invokes the code: batch_process_documents(project_id='', location='us', processor_id='', gcs_input_uri='gs:///Invoice.pdf', gcs_output_uri='gs://*', gcs_output_uri_prefix='inv')
  2. Run the boiler plate code.

Code example

# example

Stack trace

--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-30-42be8c6d0dd8> in <module> ----> 1 batch_process_documents(project_id='***', location='us', processor_id='***', gcs_input_uri='gs://***/Invoice.pdf', gcs_output_uri='gs://***', gcs_output_uri_prefix='inv') <ipython-input-28-f0fe586dfadb> in batch_process_documents(project_id, location, processor_id, gcs_input_uri, gcs_output_uri, gcs_output_uri_prefix) 66 for i, blob in enumerate(blob_list): 67 # Download the contents of this blob as a bytes object. ---> 68 blob_as_bytes = blob.download_as_bytes() 69 document = documentai.types.Document.from_json(blob_as_bytes) 70 AttributeError: 'Blob' object has no attribute 'download_as_bytes' 

Making sure to follow these steps will guarantee the quickest resolution possible.

Thanks!

Metadata

Metadata

Assignees

Labels

api: documentaiIssues related to the googleapis/python-documentai API.status: investigatingThe issue is under investigation, which is determined to be non-trivial.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions