We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi all! Log output: ConnectionResetError: [Errno 104] Connection reset by peer 2017-12-15 10:10:06,661 pytg: INFO CLI did not responde.
Tell us what happens instead.
ubuntu:16.04
3.5.2
0.4.10
Detailed steps to reproduce the issue.
# coding=utf-8 import time import os from pytg import Telegram from pytg.utils import coroutine import requests from pytg import exceptions from datetime import datetime import logging from socket import error as SocketError logging.basicConfig(level=logging.INFO, format='%(asctime)s %(name)s: %(levelname)s %(message)s') def post_to_db(post): # do something def main(): home_dir = os.environ.get("TELEGRAM_HOME") port = os.environ.get("TELEGRAM_PORT") tg = Telegram( telegram="/tg-cli/telegram-cli", port = int(port), pubkey_file="/tg-cli/tg-server.pub", home_directory=home_dir) receiver = tg.receiver sender = tg.sender try: receiver.start() except Exception as e: logging.info("cannot start receiver for receive new messages: {error}".format(str(e))) receiver.stop() quit() try: receiver.message(message_func(sender)) except SocketError as e: logging.info("cannot receive new messages: {error}".format(str(e))) receiver.stop() sender.safe_quit() except Exception as e: logging.info("cannot receive new messages: {error}".format(str(e))) receiver.stop() sender.safe_quit() receiver.stop() sender.safe_quit() @coroutine def message_func(sender): try: while True: msg = (yield) try: sender.status_online() msg = dict(msg) # print (msg) if msg.get("event") != "message": continue if msg.get("text") is None: continue elif "from" in msg: post_to_db(post) elif "to" in msg: post_to_db(post) elif "sender" in msg: post_to_db(post) else: quit() except exceptions.NoResponse: quit() except KeyboardInterrupt: quit() except Exception as e: print (e) logging.info("could not receive new messages: {error}".format(str(e))) quit() except GeneratorExit: # pass quit() else: # pass quit() if __name__ == '__main__': main()
The text was updated successfully, but these errors were encountered:
Heya, could you set the logging level to logging.DEBUG instead of logging.INFO, to give more information?
logging.DEBUG
logging.INFO
Also, using logging.exception("whatever") instead of print(e) will print you the stacktrace of an Exception, giving me a bit more to work with.
logging.exception("whatever")
print(e)
Sorry, something went wrong.
No branches or pull requests
The problem
Hi all!
Log output:
ConnectionResetError: [Errno 104] Connection reset by peer
2017-12-15 10:10:06,661 pytg: INFO CLI did not responde.
Actual behaviour
Tell us what happens instead.
Your environment
ubuntu:16.04
3.5.2
0.4.10
Steps to reproduce
Detailed steps to reproduce the issue.
The text was updated successfully, but these errors were encountered: