Giter Site home page Giter Site logo

google_drive_ocr's Issues

More customizable CLI

Feature Description

GoogleOCRApplication class supports

  • specifying suffix for output text files
  • specifying output path explicitly when single image

Expose these methods to CLI for a greater control

Is application working atm?

  • google-drive-ocr version: 0.2.6
  • Python version: 3.10.11
  • Operating System: windows 10

Question:

Can you confirm what this application still working as intended?
I first set it up about a month ago and successfully used for a while. Today I attempted to OCR some images, but now then I try to use it in command line mode I am getting this
Here is the error block:

Traceback (most recent call last):
File "C:\Utils\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Utils\Python\Python310\lib\runpy.py", line 86, in run_code
exec(code, run_globals)
File "C:\Utils\Python\Python310\Scripts\google-ocr.exe_main
.py", line 7, in
File "C:\Utils\Python\Python310\lib\site-packages\google_drive_ocr\cli.py", line 117, in main
app = GoogleOCRApplication(
File "", line 9, in init
File "C:\Utils\Python\Python310\lib\site-packages\google_drive_ocr\application.py", line 98, in post_init
creds = self.get_credentials()
File "C:\Utils\Python\Python310\lib\site-packages\google_drive_ocr\application.py", line 144, in get_credentials
creds.refresh(Request())
File "C:\Utils\Python\Python310\lib\site-packages\google\oauth2\credentials.py", line 339, in refresh
) = reauth.refresh_grant(
File "C:\Utils\Python\Python310\lib\site-packages\google\oauth2\reauth.py", line 367, in refresh_grant
_client._handle_error_response(response_data, retryable_error)
File "C:\Utils\Python\Python310\lib\site-packages\google\oauth2_client.py", line 74, in _handle_error_response
raise exceptions.RefreshError(
google.auth.exceptions.RefreshError: ('invalid_grant: Bad Request', {'error': 'invalid_grant', 'error_description': 'Bad Request'})

I tried creating and using new secret.json but nothing changes.
Did I managed to mess something up on my side between then and now, or is this just google changing stuff over time?

[QUESTION] How to refresh to new client ID?

  • google-drive-ocr version: 0.2.6
  • Python version: Python 3.12.2
  • Operating System: macOS Sonoma 14.2.1

Question

The token had expired, so I deleted the project and re-created a new project. (Both the old and new projects are just for doing OCR)
I downloaded the new client_secret.json file and tried to perform OCR, but I get the following error.
Is it something to do with cache, etc.?

google.auth.exceptions.RefreshError: ('invalid_client: Unauthorized', {'error': 'invalid_client', 'error_description': 'Unauthorized'})

google-drive-ocr runtime error ...Installed successfully Android

  • Google OCR (Drive API v3) version: dont know
  • Python version: 3.10
  • Operating System: Android arm64 Termux

Description

Runtime error

What I Did

Install via

pkg install popper
pip install google_drive_ocr
cd <libDir>
ln -s liblcms2.so liblcms2.so.2

#google-ocr --config /storage/28E1-1BF4/GoogleOCR/gdo.cfg --pdf /storage/emulated/0/Download/In.pdf --pages 1-3 --verbose

Storing credentials to /data/data/com.termux/files/home/.credentials/token.json file_cache is only supported with oauth2client<4.0.0 Extracting 3 pages from '/storage/emulated/0/Download/In.pdf' .. Extracted 3 pages: 1 to 3. Traceback (most recent call last): File "/data/data/com.termux/files/usr/bin/google-ocr", line 8, in sys.exit(main()) File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/google_drive_ocr/cli.py", line 153, in main app.perform_ocr_batch( File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/google_drive_ocr/application.py", line 266, in perform_ocr_batch _workload = workload + (idx < extra) UnboundLocalError: local variable 'extra' referenced before assignment

BUG: Accès bloqué

Accès bloqué : [.....] n'a pas terminé la procédure de validation de Google

Support write output to file

It seems the package does not support write the output to file itself. It is great if the command line has an option to write the ocr result to output file like .txt or docs or any text extension.

Thank you

google-ocr stopped working suddenly

  • google-drive-ocr version: google-ocr 0.2.6
  • Python version: 3.11.5
  • Operating System: MacOS 14.0 (23A344)

Description

It was working earlier but stopped a few days ago. Following is the command I ran and the error.

What I Did

> google-ocr -i image.png --client-secret client_secret_11_oct_2023.json --debug                                                                                                   

{'__module__': 'google_drive_ocr.cli', 'image': 'image.png', 'batch': None, 'image_dir': None, 'output': None, 'extension': '.png', 'suffix': '.google.txt', 'pdf': None, 'pages': None, 'client_secret': 'client_secret_11_oct_2023.json', 'upload_folder_id': None, 'workers': 1, 'no_keep': False, 'verbose': False, 'debug': True, '__dict__': <attribute '__dict__' of 'Config' objects>, '__weakref__': <attribute '__weakref__' of 'Config' objects>, '__doc__': None, 'config_file': None, 'write_out_config_file_to_this_path': None}
Making request: POST https://oauth2.googleapis.com/token
Starting new HTTPS connection (1): oauth2.googleapis.com:443
https://oauth2.googleapis.com:443 "POST /token HTTP/1.1" 400 None
Traceback (most recent call last):
  File "/usr/local/bin/google-ocr", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/local/lib/python3.11/site-packages/google_drive_ocr/cli.py", line 117, in main
    app = GoogleOCRApplication(
          ^^^^^^^^^^^^^^^^^^^^^
  File "<string>", line 9, in __init__
  File "/usr/local/lib/python3.11/site-packages/google_drive_ocr/application.py", line 98, in __post_init__
    creds = self.get_credentials()
            ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/google_drive_ocr/application.py", line 144, in get_credentials
    creds.refresh(Request())
  File "/usr/local/lib/python3.11/site-packages/google/oauth2/credentials.py", line 344, in refresh
    ) = reauth.refresh_grant(
        ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/google/oauth2/reauth.py", line 365, in refresh_grant
    _client._handle_error_response(response_data, retryable_error)
  File "/usr/local/lib/python3.11/site-packages/google/oauth2/_client.py", line 72, in _handle_error_response
    raise exceptions.RefreshError(
google.auth.exceptions.RefreshError: ('invalid_grant: Bad Request', {'error': 'invalid_grant', 'error_description': 'Bad Request'})

Runtime error

  • Google OCR (Drive API v3) version:
  • Python version: 3.10
  • Operating System: Arm64

Description

Installed via Source
Runtime error...
Got x3 separate pages in my dir though ...

What I Did

~ $ google-ocr --config /storage/28E1-1BF4/GoogleOCR/gdo.cfg --pdf /storage/emulated/0/Download/In.pdf
Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/bin/google-ocr", line 33, in <module>
    sys.exit(load_entry_point('google-drive-ocr==0.2.5', 'console_scripts', 'google-ocr')())
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/google_drive_ocr/cli.py", line 153, in main
    app.perform_ocr_batch(
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/google_drive_ocr/application.py", line 266, in perform_ocr_batch
    _workload = workload + (idx < extra)
UnboundLocalError: local variable 'extra' referenced before assignment

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.