Skip to content
New issue

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

Problem With bad Internet #120

Open
sae13 opened this issue Jun 1, 2017 · 1 comment
Open

Problem With bad Internet #120

sae13 opened this issue Jun 1, 2017 · 1 comment

Comments

@sae13
Copy link

sae13 commented Jun 1, 2017

Hi there My internet speed is awefull ,
sometimes it stays in script but it does nothing.
and sometimes it come out with error below,
Is there any way It load itself after a special time. like every one minute


`Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/pytg/sender.py", line 504, in _do_send
    answer = self.s.recv(1)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "tgDelete.py", line 101, in <module>
    main()
  File "tgDelete.py", line 42, in main
    receiver.message(schedulerDeleter(sender))
  File "/usr/lib/python3.6/site-packages/pytg/utils.py", line 29, in start
    cr = func(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/pytg/receiver.py", line 212, in message
    function.send(message)
  File "tgDelete.py", line 52, in schedulerDeleter
    sender.status_online()
  File "/usr/lib/python3.6/site-packages/pytg/sender.py", line 630, in command_alias
    return self.execute_function(command_name, *args, **kwargs)
  File "/usr/lib/python3.6/site-packages/pytg/sender.py", line 320, in execute_function
    result = self._do_send(request, answer_timeout=self.default_answer_timeout, retry_connect=retry_connect)
  File "/usr/lib/python3.6/site-packages/pytg/sender.py", line 527, in _do_send
    raise NoResponse(command)
pytg.exceptions.NoResponse: [disable_preview] status_online 

`
@luckydonald
Copy link
Owner

You can wrap it in a try

try:
    # code here
except pytg.exceptions.NoResponse as e:
    # handle the error

And write some code which handles the error (e.g. retry, or restart)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants