Telegram bot, quote=False issue - telegram

I'm having some troubles with the python-telegram-bot. I've been working in a local ubuntu virtual machine with no problems. I've uploaded the .py to a virtual machine on another server (24/7 running) and i run with some issues.
I'm getting this error:
telegram.ext.dispatcher - ERROR - No error handlers are registered, logging exception.
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/telegram/ext/dispatcher.py", line 555, in process_update
handler.handle_update(update, self, check, context)
File "/usr/local/lib/python3.8/dist-packages/telegram/ext/handler.py", line 198, in handle_update
return self.callback(update, context)
File "scriptbot_v7.py", line 77, in opciones
query.edit_message_text(text=info(), parse_mode='html', quote=False)
TypeError: edit_message_text() got an unexpected keyword argument 'quote'
Any ideas why quote is not working anymore? When I delete that it works, but everyone sees what someone else is saying and I preferred that doesn't happend.

The quote argument only exists for the telegram.Message.reply_* methods. It's just a shortcut for passing the correct reply_to_message_id. Because Bot/CallbackQuery.edit_message_text doesn't have a reply_to_message_id paramater, there also is no quote parameter. This is because while editing a message, you can't change whether it's a reply or not.
When I delete that it works, but everyone sees what someone else is saying and I preferred that doesn't happend.
Note that is not possible to send messages to group chats that can only be seen by some of the members. Everything posted in a group can be seen by every member of that group.
Disclaimer: I'm currently the maintainer of python-telegram-bot

Related

what is "Unknown(0x)" error when swapping tokens in web3.js?

I'm swapping tokens using web3.js sometimes it succeeds and sometimes it fails, but when it fails I get this error in my console:
VM Exception while processing transaction: revert callBytes failed: Unknown(0x)
and I believe it is the same as the error below from etherscan:
enter image description here
can someone please tell me what is this error and how to solve it?
thank you for your time.

What does the exception : "Service provider invocation failure" mean? and what is the commonly known fix for this?

I am trying to make a call for PriceQuoteService by importing new WSDL. There was an error while I tried to make the call where the auto-generated code of WSDL contained [][] instead of []. Upon making necessary replaces I am getting "Service provider invocation failure". I could not find mention of this error in all related documents.
I would like to know the cause and likely fix for this.

inputstream is closed error while uploading zip file through jsch to sftp site

While uploading a zip file to SFTP, we are getting the below error. The same code is working fine for another application. We are using jsch-0.1.44.jar for SFTP connection.
java.io.IOException: inputstream is closed
at com.jcraft.jsch.ChannelSftp._put(ChannelSftp.java:571)
at com.jcraft.jsch.ChannelSftp.put(ChannelSftp.java:431)
at com.jcraft.jsch.ChannelSftp.put(ChannelSftp.java:398)
aused by: java.io.IOException: inputstream is closed
at com.jcraft.jsch.ChannelSftp.fill(ChannelSftp.java:2326)
at com.jcraft.jsch.ChannelSftp.header(ChannelSftp.java:2350)
at com.jcraft.jsch.ChannelSftp.checkStatus(ChannelSftp.java:1923)
at com.jcraft.jsch.ChannelSftp._put(ChannelSftp.java:559)
... 6 more
I searched stackoverflow and many other sources in internet to get an answer.
There were two reasons I found which was not the cause for my specific issue.
1) This exception usually means the connection was closed abruptly. I would look at the logs on the server to see if there was an error.
2)The root cause of this error was that in the code, remote path was being opened twice. So, even if, no channel is actually closed, but, when the remote path is tried to open 2nd time, the existing path/channel is also closed or something and this exception is raised.
After doing some POC, whatever changes we made to code did not have any impact. One of the thing which was looked at was passing inputstream object as a parameter to a method where actually put method of channelsftp is being called.
this.channelSftp.put(inputstream, strFileName );
Instead of passing inputstream from another method, code was written to form inputstream inside the method where this put is being called. This does not have any impact.
Tried uploading a file to sftp site through code. Same error was being thrown.
Later what we found was that there was no code issue. Even a manual upload was failing. This indicated us to dig further about this SFTP engagement details and found that the FILENAME format we are using is not what SFTP has configured. When we matched the filename format, the issue was resolved.
I've recently encountered an issue similar to this, in my case it was a an issue when logging on to the remote machine using JSch.
When trying to manually connect to the machine I found that the password had expired and was prompting for a new one on login. It was able to connect and authenticate however once connected it was unable to get any further. This explained why it was an inputstream failure and not an authentication failure.
I know this is an old question but to anyone else in the same position trawling the web for an answer it might just be a simple solution like this.
Nikola and I were facing this issue as well. It was not a problem due to permissions or passwords or whatever.
We are using the CachingSessionFactory. The sessions are closed arbitrarily by the server OR by the client application. We described our solution in another StackOverFlow: Sftp File Upload Fails
I also had a similar issue. Also want to add that it was not related to code but to access rights. I connected with a user that could connect via ssh but that could not send file through stp. Changing the user with proper access rights solved the issue
I tried above options, and none seems to be worked for my use case.
In my use case, we upload files to sftp using JSCH parallelly. Most of the uploads were successful but very few used to fail with above error.
On investigating the implementation, I found that the library returns the connection from pool which is not close. In our case one of the thread was closing the connection before another concurrent thread could finish upload hence causing IOException: input stream is closed error.
We have enabled testSession feature on cachingConnectionFactory. It will return the pooled connection if it is not closed and can actually list files from the SFTP. This solved our issue.
Posting the sample code here
DefaultSftpSessionFactory sessionFactory1 = new DefaultSftpSessionFactory();
sessionFactory1.setHost("host");
sessionFactory1.setPort(21);
sessionFactory1.setUser("userName");
sessionFactory1.setPassword("password");
CachingSessionFactory<ChannelSftp.LsEntry> cachingSessionFactory = new CachingSessionFactory<>(sessionFactory, 10);
cachingSessionFactory.setSessionWaitTimeout(2000);
cachingSessionFactory.setTestSession(true);`

AttributeError when restarting

Our production system works as a cluster of Zope workers that have a ZEO server as a backend, pretty usual stuff.
As we have quite a lot of data our instances consume too much memory and we have a watchdog that restarts them whenever they go above a limit. The restarting code is basically:
bin/supervisorctl reload
Whenever that happens we get quite a lot of emails from our workers with stacktraces like (and that's the full stacktrace):
Couldn't load state for 0x052aec
Traceback (most recent call last):
File "/home/service/.buildout/eggs/ZODB3-3.10.5-py2.7-linux-x86_64.egg/ZODB/Connection.py", line 860, in setstate
self._setstate(obj)
File "/home/service/.buildout/eggs/ZODB3-3.10.5-py2.7-linux-x86_64.egg/ZODB/Connection.py", line 901, in _setstate
p, serial = self._storage.load(obj._p_oid, '')
AttributeError: 'NoneType' object has no attribute 'load'
I thought it was normal until I saw this question which was pointing that that could only happen to RelStorage users, and we are not using RelStorage...
Any idea on if that indicates something or we can (as we already do, although it bothers me) just automatically mark those messages from our workers as read on our mail client?
Is there any nicer/softer way to tell a Zope worker to restart? Some sort of a "finish the request you are dealing with and then restart"

Session Token Authentication perl in cookie

I am working session authentication. I am passing session id as token in cookie header. I wish to get encrypted token. which cryptable method should i prefer. I am using Digest::SHA, i got this error
The server encountered an internal error and was unable to complete your request.
Error message:
Attempt to reload Digest/SHA1.pm aborted. Compilation failed in require at /opt/lampp/htdocs/cts/login.pl line 21. BEGIN failed--compilation aborted at /opt/lampp/htdocs/cts/login.pl line 21.
what should do to overcome this error? Otherwise shall i use another one?
Try debugging your code. Take it through step by step, and look at the value of each variable. That might give you some insight, or at least give you a more specific understanding of why the program is failing to load. From the question you've given to us here, you really aren't giving us much to go off :)

Resources