zeshuaro / telegram-pdf-bot

A Telegram bot that can do a lot of things related to PDF files
https://t.me/pdfbot
GNU Affero General Public License v3.0
195 stars 97 forks source link

installation and run in local machine faqs #308

Closed gunasekharravilla closed 3 years ago

gunasekharravilla commented 3 years ago
File "/app/bot.py", line 32, in <module>
2021-05-22T05:05:08.303619+00:00 app[worker.1]:     from pdf_bot import *
2021-05-22T05:05:08.303641+00:00 app[worker.1]:   File "/app/pdf_bot/__init__.py", line 1, in <module>
2021-05-22T05:05:08.303755+00:00 app[worker.1]:     from pdf_bot.commands import (
2021-05-22T05:05:08.303773+00:00 app[worker.1]:   File "/app/pdf_bot/commands/__init__.py", line 1, in <module>
2021-05-22T05:05:08.303887+00:00 app[worker.1]:     from pdf_bot.commands.compare import compare_cov_handler
2021-05-22T05:05:08.303905+00:00 app[worker.1]:   File "/app/pdf_bot/commands/compare.py", line 9, in <module>
2021-05-22T05:05:08.304023+00:00 app[worker.1]:     from pdf_bot.constants import PDF_INVALID_FORMAT, PDF_OK, CANCEL, BACK, TEXT_FILTER
2021-05-22T05:05:08.304041+00:00 app[worker.1]:   File "/app/pdf_bot/constants.py", line 5, in <module>
2021-05-22T05:05:08.304170+00:00 app[worker.1]:     t = gettext.translation("pdf_bot", localedir="locale", languages=["en_GB"])
2021-05-22T05:05:08.304187+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/gettext.py", line 592, in translation
2021-05-22T05:05:08.304490+00:00 app[worker.1]:     raise FileNotFoundError(ENOENT,
2021-05-22T05:05:08.304494+00:00 app[worker.1]: FileNotFoundError: [Errno 2] No translation file found for domain: 'pdf_bot'
zeshuaro commented 3 years ago

I'm not sure what was your intention for just dumping an error traceback without saying anything. But you didn't compile the translation files, see here to see more information.

gunasekharravilla commented 3 years ago

when I try to run and deploy the app my app is getting crashed due to the above error, So i'm asking the solution how to solve this error

zeshuaro commented 3 years ago

But you didn't compile the translation files, see here to see more information.

I've already explained what you should do in my previous comment

gunasekharravilla commented 3 years ago

I deployed the repository master branch directly into the Heroku

gunasekharravilla commented 3 years ago

one More help explain to me regarding GCP_KEY_FILE path

how to setup it

gunasekharravilla commented 3 years ago

google.auth.exceptions.DefaultCredentialsError: Could not automatically determine credentials. Please set GOOGLE_APPLICATION_CREDENTIALS or explicitly create credentials and re-run the application.

getting this error

zeshuaro commented 3 years ago

You'll have to setup authentication for Datastore, see here for instructions on obtaining the key file then set GCP_KEY_FILE to the path of that file

gunasekharravilla commented 3 years ago
 TelegramDeprecationWarning: DelayQueue in its current form is deprecated and will be reinvented in a future release. See https://git.io/JtDbF for a list of known bugs.
  warnings.warn(
INFO: Adding job tentatively -- it will be properly scheduled when the scheduler starts
INFO: Added job "restart" to job store "default"
INFO: Scheduler started
NOTICE: Bot started webhook

currently i am here could you please explain what to do next to start using bot

zeshuaro commented 3 years ago

The bot should be up and running, you can talk to it on Telegram 🙂

gunasekharravilla commented 3 years ago

but my bot is not responding what is the APP_URL while running in local machine

gunasekharravilla commented 3 years ago

How setup GCP_KEY_FILE in Heroku I used Github raw data link for JSON but in Heroku console showing file not found. how did you set up it?

gunasekharravilla commented 3 years ago
2021-05-27T07:13:04.143713+00:00 app[worker.1]: Traceback (most recent call last):
2021-05-27T07:13:04.143732+00:00 app[worker.1]:   File "/app/bot.py", line 31, in <module>
2021-05-27T07:13:04.143985+00:00 app[worker.1]:     from pdf_bot import *
2021-05-27T07:13:04.144016+00:00 app[worker.1]:   File "/app/pdf_bot/__init__.py", line 9, in <module>
2021-05-27T07:13:04.144265+00:00 app[worker.1]:     from pdf_bot.files import file_cov_handler
2021-05-27T07:13:04.144265+00:00 app[worker.1]:   File "/app/pdf_bot/files/__init__.py", line 1, in <module>
2021-05-27T07:13:04.144294+00:00 app[worker.1]:     from pdf_bot.files.file import file_cov_handler
2021-05-27T07:13:04.144317+00:00 app[worker.1]:   File "/app/pdf_bot/files/file.py", line 18, in <module>
2021-05-27T07:13:04.144440+00:00 app[worker.1]:     from pdf_bot.files.ocr import add_ocr_to_pdf
2021-05-27T07:13:04.144456+00:00 app[worker.1]:   File "/app/pdf_bot/files/ocr.py", line 4, in <module>
2021-05-27T07:13:04.144581+00:00 app[worker.1]:     import ocrmypdf
2021-05-27T07:13:04.144584+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/ocrmypdf/__init__.py", line 10, in <module>
2021-05-27T07:13:04.144722+00:00 app[worker.1]:     from ocrmypdf import helpers, hocrtransform, leptonica, pdfa, pdfinfo
2021-05-27T07:13:04.144727+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/ocrmypdf/leptonica.py", line 44, in <module>
2021-05-27T07:13:04.144923+00:00 app[worker.1]:     raise MissingDependencyError(
2021-05-27T07:13:04.145034+00:00 app[worker.1]: ocrmypdf.exceptions.MissingDependencyError: 
2021-05-27T07:13:04.145039+00:00 app[worker.1]:         ---------------------------------------------------------------------
2021-05-27T07:13:04.145040+00:00 app[worker.1]:         This error normally occurs when ocrmypdf can't find the Leptonica
2021-05-27T07:13:04.145044+00:00 app[worker.1]:         library, which is usually installed with Tesseract OCR. It could be that
2021-05-27T07:13:04.145045+00:00 app[worker.1]:         Tesseract is not installed properly, we can't find the installation
2021-05-27T07:13:04.145049+00:00 app[worker.1]:         on your system PATH environment variable.
2021-05-27T07:13:04.145059+00:00 app[worker.1]: 
2021-05-27T07:13:04.145059+00:00 app[worker.1]:         The library we are looking for is usually called:
2021-05-27T07:13:04.145059+00:00 app[worker.1]:             liblept-5.dll   (Windows)
2021-05-27T07:13:04.145059+00:00 app[worker.1]:             liblept*.dylib  (macOS)
2021-05-27T07:13:04.145060+00:00 app[worker.1]:             liblept*.so     (Linux/BSD)
2021-05-27T07:13:04.145060+00:00 app[worker.1]: 
2021-05-27T07:13:04.145060+00:00 app[worker.1]:         Please review our installation procedures to find a solution:
2021-05-27T07:13:04.145061+00:00 app[worker.1]:             https://ocrmypdf.readthedocs.io/en/latest/installation.html
2021-05-27T07:13:04.145061+00:00 app[worker.1]:         ---------------------------------------------------------------------
2021-05-27T07:13:04.145065+00:00 app[worker.1]:   
2021-05-27T07:13:04.545807+00:00 heroku[worker.1]: Process exited with status 1
2021-05-27T07:13:04.633135+00:00 heroku[worker.1]: State changed from up to crashed
2021-05-27T07:13:15.000000+00:00 app[api]: Build succeeded      

This may be the last issue. It is solved in the local machine by using pip3 install ocrmypdf but again getting the same issue in Heroku buts it doesn't work when using the same command in Run console in more(Heroku Dashboard)

zeshuaro commented 3 years ago

what is the APP_URL while running in local machine

You can leave the APP_URL as the bot will fallback to use the polling method which works fine most of the time

How setup GCP_KEY_FILE in Heroku I used Github raw data link for JSON but in Heroku console showing file not found. how did you set up it?

Check out this section for how I did it

ormypdf missing dependencies

See here for installation instructions

gunasekharravilla commented 3 years ago

Thank you so much brother I finally executed and deployed using the polling method My Chatbot Link

stale[bot] commented 3 years ago

This issue has been automatically closed due to inactivity. Feel free to comment in order to reopen.

gunasekharravilla commented 3 years ago

how to get statistics of the bot