P
P
pasha4042016-05-12 19:06:23
Telegram
pasha404, 2016-05-12 19:06:23

How to run a telegram bot on GAE (telebot framework)?

I'm trying to solve the actual issue. I tried a simple version with the telegram framework - it works. But I already have a ready bot in telebot. Has anyone tried this kind of connection? I don't understand what is missing.
This is in the log:

Thread running after request. Creation traceback:
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/runtime.py", line 152, in HandleRequest
    error)
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 329, in HandleRequest
    return WsgiRequest(environ, handler_name, url, post_data, error).Handle()
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 240, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
    handler, path, err = LoadObject(self._handler)
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 85, in LoadObject
    obj = __import__(path[0])
  File "/base/data/home/apps/s~pashatest2bot/1.392737687037819472/bot_gae2.py", line 34, in <module>
    bot = telebot.TeleBot(API_TOKEN)
  File "/base/data/home/apps/s~pashatest2bot/1.392737687037819472/lib/telebot/__init__.py", line 75, in __init__
    self.worker_pool = util.ThreadPool()
  File "/base/data/home/apps/s~pashatest2bot/1.392737687037819472/lib/telebot/util.py", line 86, in __init__
    self.workers = [WorkerThread(self.on_exception, self.tasks) for _ in range(num_threads)]
  File "/base/data/home/apps/s~pashatest2bot/1.392737687037819472/lib/telebot/util.py", line 40, in __init__
    self.start()
  File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/threading.py", line 505, in start
    _start_new_thread(self.__bootstrap, ())
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/runtime.py", line 82, in StartNewThread
    return base_start_new_thread(Run, ())

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kxekxe, 2017-10-10
@kxekxe

If it's still relevant, I also encountered the same error. It was in the TeleBot constructor, which by default works in multithreading mode. GAE doesn't seem to let you work with threads for free. This challenge helped me.
bot = telebot.TeleBot(API_TOKEN, threaded = False)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question