-
Notifications
You must be signed in to change notification settings - Fork 76
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
Exception handler problem in sender #46
Comments
This is #33 again. It just needs a dummy handler. |
The problem for me is not so much the logging but the exception not handled. I actually get a problem with no_response from Telegram. The message goes through but there is an exception I can only assume is no_response. I commented all the "raise" statements out and made the timeout on the function 1 second. I get all my messages and photos through but the code is broken or missing a specific handler. |
I put the logger stuff in and now have a lot more information reported. Maybe this will help. It does look like no_response from Telegram. I still have the "raise" commented out in the sender. [SUCCESS] dropbox account linked
[INFO] warming up...
[INFO] starting background model...
[UPLOAD] Saturday 17 October 2015 09:14:50AM
[IMAGE] .//5897f668-19bc-499f-b422-53e00b41c7fe.jpg
ERROR:pytg.sender:Result parser does not allow exceptions, but we got one:
Traceback (most recent call last):
File "build/bdist.linux-armv7l/egg/pytg/sender.py", line 250, in execute_function
result = self._do_command(command_name, new_args, answer_timeout=result_timeout, retry_connect=retry_connect, enable_preview=enable_preview, reply_id=reply_id)
File "build/bdist.linux-armv7l/egg/pytg/sender.py", line 360, in _do_command
result = self._do_send(request, answer_timeout=answer_timeout, retry_connect=retry_connect)
File "build/bdist.linux-armv7l/egg/pytg/sender.py", line 450, in _do_send
raise NoResponse(command)
NoResponse: [disable_preview] send_photo Roaming_Camera './/5897f668-19bc-499f-b422-53e00b41c7fe.jpg' 'Taken at - Saturday 17 October 2015 09:14:50AM'
ERROR:pytg.sender:Result parser did not allow exceptions.
(Security Feed:1905): GLib-GObject-WARNING **: Attempt to add property GtkSettings::gtk-label-select-on-focus after class was initialised
WARNING:pytg.sender:Terminating currently sending request.
WARNING:pytg.sender:Terminating currently sending request.
Exception in thread Receiver (pytg):
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 505, in run
self.__target(*self.__args, **self.__kwargs)
File "build/bdist.linux-armv7l/egg/pytg/receiver.py", line 128, in _receiver
raise ConnectionError("Remote end closed.")
ConnectionError: Remote end closed. |
I am not currently have a runnable telegram CLI configured, and didn't work on this for half an year. So I have no direct clue what's going on. Can you please try what happens if you enter the sent command [disable_preview] send_photo Roaming_Camera './/5897f668-19bc-499f-b422-53e00b41c7fe.jpg' 'Taken at - Saturday 17 October 2015 09:14:50AM' manually in the cli (with json enabled)? |
Next step we could test: $ nc localhost 4458 Then see if that command works, and if you get a response. |
I did tyhe test from within cli and it was immediate. The response is included in the code below. I tried the netcat test but cannot get it to work. Also see below. I dont know netcall at all so I can't say that I did it right. pi@rpi2b /usr/local/src/tg $ bin/telegram-cli -k tg-server.pub -W
Telegram-cli version 1.3.3, Copyright (C) 2013-2015 Vitaly Valtman
Telegram-cli comes with ABSOLUTELY NO WARRANTY; for details type `show_license'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show_license' for details.
Telegram-cli uses libtgl version 2.0.3
Telegram-cli includes software developed by the OpenSSL Project
for use in the OpenSSL Toolkit. (http://www.openssl.org/)
Telegram-cli uses libpython version 2.7.3
I: config dir=[/home/pi/.config/telegram-cli]
> send_photo Roaming_Camera /home/pi/development/pi-home-surveillance/dec6dd43-b707-48fb-94f3-585b60a7ca43.jpg
[10:53] Roaming Camera Sentry Camera >>> [photo] Netcat result pi@rpi2b /usr/local/src/tg $ nc localhost 4458 send_photo Roamin_Camera /home/pi/development/pi-home-surveillance/dec6dd43-b707-48fb-94f3-585b60a7ca43.jpg
nc: getaddrinfo: Servname not supported for ai_socktype |
sorry, I forgot to mention to start the additonal cli parameters listening to the port, and netcat was unclear. bin/telegram-cli -k tg-server.pub -W --json -P 4458 Please retry both. $ nc localhost 4458 [enter] and then typing your commands as you would in the CLI |
Ok I got netcat going. I opened telegram as you asked with no problem and I sent messages as below. All with no problem and no delay. This what I done:- msg Roaming_Camera Test Message Don't see anything strange unless you did not exdpect a 0 in the answer |
|
This is how I called telegram and the output from that. pi@rpi2b /usr/local/src/tg $ bin/telegram-cli -k tg-server.pub -W --json -P 4485
Telegram-cli version 1.3.3, Copyright (C) 2013-2015 Vitaly Valtman
Telegram-cli comes with ABSOLUTELY NO WARRANTY; for details type `show_license'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show_license' for details.
Telegram-cli uses libtgl version 2.0.3
Telegram-cli includes software developed by the OpenSSL Project
for use in the OpenSSL Toolkit. (http://www.openssl.org/)
Telegram-cli uses libpython version 2.7.3
I: config dir=[/home/pi/.config/telegram-cli] |
If you get a message or some other event, is that json format? |
My application only makes use of sender. I dont read anything back at this time so I cant answer. I can try something if you want to make a suggestion on how to do that. |
When your CLI recieves a message, can you post that output? (sorry for the delay) |
Hi
I found this error after I uploaded a photo with sender.send_photo.
The text was updated successfully, but these errors were encountered: