Giter Club home page Giter Club logo

Comments (17)

ismoil-nosr avatar ismoil-nosr commented on May 29, 2024

This is the error that I'm getting while trying to start the bot

from greed.

Steffo99 avatar Steffo99 commented on May 29, 2024

This error means that the database engine did not found the required tables.
Have you run db.py at least once before starting the core, as explained in the README?

from greed.

ismoil-nosr avatar ismoil-nosr commented on May 29, 2024

No. I didn't know about that. Could you tell me where is it placed?

from greed.

Steffo99 avatar Steffo99 commented on May 29, 2024

Whoops, just noticed a typo in the readme, will fix as soon as I get to a computer.
You're supposed to run python3.6 -OO database.py before starting core.py.

from greed.

ismoil-nosr avatar ismoil-nosr commented on May 29, 2024

OK, I did it, but now get this one:

greed-bot is now starting!
Exception in thread Worker 411164928:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/base.py", line 1193, in _execute_context
context)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/default.py", line 509, in do_execute
cursor.execute(statement, parameters)
sqlite3.OperationalError: no such table: users

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/home/ubuntu/greed/worker.py", line 64, in run
self.user = self.session.query(db.User).filter(db.User.user_id == self.chat.id).one_or_none()
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/query.py", line 2917, in one_or_none
ret = list(self)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/query.py", line 2988, in iter
return self._execute_and_instances(context)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/query.py", line 3011, in _execute_and_instances
result = conn.execute(querycontext.statement, self._params)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/base.py", line 948, in execute
return meth(self, multiparams, params)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/sql/elements.py", line 269, in _execute_on_connection
return connection._execute_clauseelement(self, multiparams, params)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/base.py", line 1060, in _execute_clauseelement
compiled_sql, distilled_params
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/base.py", line 1200, in _execute_context
context)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/base.py", line 1413, in _handle_dbapi_exception
exc_info
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/util/compat.py", line 265, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=cause)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/util/compat.py", line 248, in reraise
raise value.with_traceback(tb)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/base.py", line 1193, in _execute_context
context)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/default.py", line 509, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: users [SQL: 'SELECT users.user_id AS users_user_id, users.first_name AS users_first_name, users.last_name AS users_last_name, users.username AS users_username, users.credit AS users_credit \nFROM users \nWHERE users.user_id = ?'] [parameters: (411164928,)] (Background on this error at: http://sqlalche.me/e/e3q8)

^CTraceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 395, in _make_request
httplib_response = conn.getresponse(buffering=True)
TypeError: getresponse() got an unexpected keyword argument 'buffering'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "core.py", line 123, in
main()
File "core.py", line 41, in main
timeout=int(configloader.config["Telegram"]["long_polling_timeout"]))
File "/home/ubuntu/greed/utils.py", line 120, in result_func
return func(*args, **kwargs)
File "/home/ubuntu/greed/utils.py", line 180, in get_updates
return self.bot.get_updates(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/telegram/bot.py", line 65, in decorator
result = func(self, *args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/telegram/bot.py", line 1975, in get_updates
result = self._request.post(url, data, timeout=float(read_latency) + float(timeout))
File "/usr/local/lib/python3.6/dist-packages/telegram/utils/request.py", line 309, in post
headers={'Content-Type': 'application/json'})
File "/usr/local/lib/python3.6/dist-packages/telegram/utils/request.py", line 203, in _request_wrapper
resp = self._con_pool.request(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 70, in request
**urlopen_kw)
File "/usr/local/lib/python3.6/dist-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 148, in request_encode_body
return self.urlopen(method, url, **extra_kw)
File "/usr/local/lib/python3.6/dist-packages/telegram/vendor/ptb_urllib3/urllib3/poolmanager.py", line 244, in urlopen
response = conn.urlopen(method, u.request_uri, **kw)
File "/usr/local/lib/python3.6/dist-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 617, in urlopen
chunked=chunked)
File "/usr/local/lib/python3.6/dist-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 398, in _make_request
httplib_response = conn.getresponse()
File "/usr/lib/python3.6/http/client.py", line 1331, in getresponse
response.begin()
File "/usr/lib/python3.6/http/client.py", line 297, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.6/http/client.py", line 258, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/usr/lib/python3.6/socket.py", line 586, in readinto
return self._sock.recv_into(b)
File "/usr/lib/python3.6/ssl.py", line 1009, in recv_into
return self.read(nbytes, buffer)
File "/usr/lib/python3.6/ssl.py", line 871, in read
return self._sslobj.read(len, buffer)
File "/usr/lib/python3.6/ssl.py", line 631, in read
v = self._sslobj.read(len, buffer)
KeyboardInterrupt

from greed.

ismoil-nosr avatar ismoil-nosr commented on May 29, 2024

Now i did changes to config.ini file and make url of sqlite like this:
engine = sqlite:////home/user/greed/db.sqlite
And it starts to work! Congrats!

from greed.

ismoil-nosr avatar ismoil-nosr commented on May 29, 2024

Bot works, But still getting errors in server side:

Timed out while calling get_updates(), retrying in 1 secs...
Timed out while calling get_updates(), retrying in 1 secs...
Timed out while calling get_updates(), retrying in 1 secs...
Timed out while calling get_updates(), retrying in 1 secs...
Timed out while calling get_updates(), retrying in 1 secs...
Timed out while calling get_updates(), retrying in 1 secs...
Timed out while calling get_updates(), retrying in 1 secs...
Timed out while calling get_updates(), retrying in 1 secs...
Timed out while calling get_updates(), retrying in 1 secs...
Timed out while calling get_updates(), retrying in 1 secs...
Timed out while calling get_updates(), retrying in 1 secs...
Timed out while calling get_updates(), retrying in 1 secs...
Timed out while calling get_updates(), retrying in 1 secs...
Timed out while calling get_updates(), retrying in 1 secs...
Timed out while calling get_updates(), retrying in 1 secs...
Timed out while calling get_updates(), retrying in 1 secs...
Timed out while calling get_updates(), retrying in 1 secs...
Timed out while calling get_updates(), retrying in 1 secs...
Timed out while calling get_updates(), retrying in 1 secs...
Timed out while calling get_updates(), retrying in 1 secs...
Timed out while calling get_updates(), retrying in 1 secs...
Timed out while calling get_updates(), retrying in 1 secs...
Timed out while calling get_updates(), retrying in 1 secs...
Timed out while calling get_updates(), retrying in 1 secs...
Timed out while calling get_updates(), retrying in 1 secs...
Timed out while calling get_updates(), retrying in 1 secs...
Timed out while calling get_updates(), retrying in 1 secs...
Timed out while calling get_updates(), retrying in 1 secs...
Timed out while calling get_updates(), retrying in 1 secs...
Timed out while calling get_updates(), retrying in 1 secs...
Timed out while calling get_updates(), retrying in 1 secs...
Timed out while calling get_updates(), retrying in 1 secs...
Timed out while calling get_updates(), retrying in 1 secs...
Timed out while calling get_updates(), retrying in 1 secs...
^CTraceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 395, in _make_request
httplib_response = conn.getresponse(buffering=True)
TypeError: getresponse() got an unexpected keyword argument 'buffering'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "core.py", line 123, in
main()
File "core.py", line 41, in main
timeout=int(configloader.config["Telegram"]["long_polling_timeout"]))
File "/home/ubuntu/greed/utils.py", line 120, in result_func
return func(*args, **kwargs)
File "/home/ubuntu/greed/utils.py", line 180, in get_updates
return self.bot.get_updates(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/telegram/bot.py", line 65, in decorator
result = func(self, *args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/telegram/bot.py", line 1975, in get_updates
result = self._request.post(url, data, timeout=float(read_latency) + float(timeout))
File "/usr/local/lib/python3.6/dist-packages/telegram/utils/request.py", line 309, in post
headers={'Content-Type': 'application/json'})
File "/usr/local/lib/python3.6/dist-packages/telegram/utils/request.py", line 203, in _request_wrapper
resp = self._con_pool.request(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 70, in request
**urlopen_kw)
File "/usr/local/lib/python3.6/dist-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 148, in request_encode_body
return self.urlopen(method, url, **extra_kw)
File "/usr/local/lib/python3.6/dist-packages/telegram/vendor/ptb_urllib3/urllib3/poolmanager.py", line 244, in urlopen
response = conn.urlopen(method, u.request_uri, **kw)
File "/usr/local/lib/python3.6/dist-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 617, in urlopen
chunked=chunked)
File "/usr/local/lib/python3.6/dist-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 398, in _make_request
httplib_response = conn.getresponse()
File "/usr/lib/python3.6/http/client.py", line 1331, in getresponse
response.begin()
File "/usr/lib/python3.6/http/client.py", line 297, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.6/http/client.py", line 258, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/usr/lib/python3.6/socket.py", line 586, in readinto
return self._sock.recv_into(b)
File "/usr/lib/python3.6/ssl.py", line 1009, in recv_into
return self.read(nbytes, buffer)
File "/usr/lib/python3.6/ssl.py", line 871, in read
return self._sslobj.read(len, buffer)
File "/usr/lib/python3.6/ssl.py", line 631, in read
v = self._sslobj.read(len, buffer)
KeyboardInterrupt
^CException ignored in: <module 'threading' from '/usr/lib/python3.6/threading.py'>
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 1294, in _shutdown
t.join()
File "/usr/lib/python3.6/threading.py", line 1056, in join
self._wait_for_tstate_lock()
File "/usr/lib/python3.6/threading.py", line 1072, in _wait_for_tstate_lock
elif lock.acquire(block, timeout):
KeyboardInterrupt

Is it normal?

from greed.

Steffo99 avatar Steffo99 commented on May 29, 2024

It depends.
If you're getting 1 every second, it means the bot is somehow unable to connect to Telegram.
If you're getting them less often (like 1 per minute) it is just a notification that the Telegram servers are being slower than usual and the bot may answer with a small delay.

Either way, it's not a problem on your end but on the Telegram side.

from greed.

ismoil-nosr avatar ismoil-nosr commented on May 29, 2024

Got it. Another problem I'm getting if I use my modified strings.py file with Russian keywords, after command
/start bot sends me text in conversation_after_start = "text...." . Bot reacts only for command /start but there no other commands, keyboards displayed. Is it bug with Russian keywords or I missed/deleted any tags/code while editing?

In server side getting this errors:

Network error while calling send_message(), retrying in 5 secs...
Network error while calling send_message(), retrying in 5 secs...
Timed out while calling send_message(), retrying in 1 secs...
Network error while calling send_message(), retrying in 5 secs...
Network error while calling send_message(), retrying in 5 secs...
^CTraceback (most recent call last):
File "core.py", line 123, in
main()
File "core.py", line 58, in main
old_worker.stop("request")
File "/home/ubuntu/greed/worker.py", line 118, in stop
self.join()
File "/usr/lib/python3.6/threading.py", line 1056, in join
self._wait_for_tstate_lock()
File "/usr/lib/python3.6/threading.py", line 1072, in _wait_for_tstate_lock
elif lock.acquire(block, timeout):
KeyboardInterrupt
^CException ignored in: <module 'threading' from '/usr/lib/python3.6/threading.py'>
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 1294, in _shutdown
t.join()
File "/usr/lib/python3.6/threading.py", line 1056, in join
self._wait_for_tstate_lock()
File "/usr/lib/python3.6/threading.py", line 1072, in _wait_for_tstate_lock
elif lock.acquire(block, timeout):
KeyboardInterrupt

from greed.

Steffo99 avatar Steffo99 commented on May 29, 2024

That's... unusual.
Do you get any errors in the console?

from greed.

ismoil-nosr avatar ismoil-nosr commented on May 29, 2024

That's... unusual.
Do you get any errors in the console?

updated comment

from greed.

Steffo99 avatar Steffo99 commented on May 29, 2024

I'm wondering what those Network Errors are.
It shouldn't be because of the cyrillic strings...
I'll try adding more detailed logging tomorrow right now, so we can find the source of the errors.

from greed.

Steffo99 avatar Steffo99 commented on May 29, 2024

Try to update to c2bed58 and run the bot without the -OO command line option (debug mode).

python3.6 core.py

from greed.

ismoil-nosr avatar ismoil-nosr commented on May 29, 2024

Well, I did as you said. After I ran bot with cyrillic strings, I got this errors:

# python3.6 core.py
greed-bot is now starting!
Timed out while calling get_updates(), retrying in 1 secs...
Network error while calling send_message(), retrying in 5 secs...
Full error: Can't parse entities: unclosed end tag at byte offset 31
Timed out while calling get_updates(), retrying in 1 secs...
Network error while calling send_message(), retrying in 5 secs...
Full error: Can't parse entities: unclosed end tag at byte offset 31
Network error while calling send_message(), retrying in 5 secs...
Full error: Can't parse entities: unclosed end tag at byte offset 31
Network error while calling send_message(), retrying in 5 secs...
Full error: Can't parse entities: unclosed end tag at byte offset 31
^CTraceback (most recent call last):
File "core.py", line 123, in
main()
File "core.py", line 58, in main
old_worker.stop("request")
File "/home/ubuntu/greed/worker.py", line 118, in stop
self.join()
File "/usr/lib/python3.6/threading.py", line 1056, in join
self._wait_for_tstate_lock()
File "/usr/lib/python3.6/threading.py", line 1072, in _wait_for_tstate_lock
elif lock.acquire(block, timeout):
KeyboardInterrupt
Network error while calling send_message(), retrying in 5 secs...
Full error: Can't parse entities: unclosed end tag at byte offset 31
^CException ignored in: <module 'threading' from '/usr/lib/python3.6/threading.py'>
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 1294, in _shutdown
t.join()
File "/usr/lib/python3.6/threading.py", line 1056, in join
self._wait_for_tstate_lock()
File "/usr/lib/python3.6/threading.py", line 1072, in _wait_for_tstate_lock
elif lock.acquire(block, timeout):
KeyboardInterrupt

And also, when I run bot, it reacts only one time to command /start but not else after.

from greed.

Steffo99 avatar Steffo99 commented on May 29, 2024

You have to replace < and > in your strings with &lt; and &gt; respectively, because Telegram reads the html tags <b>bold</b>, <i>italic</i> and <code>moonospace</code> for formatting.

from greed.

ismoil-nosr avatar ismoil-nosr commented on May 29, 2024

YES! IT WORKS!
Thanks a lot for your help!!!
You're GREAT!

from greed.

Steffo99 avatar Steffo99 commented on May 29, 2024

Thanks! If you want, let me know how the bot works, how do you want to use it and if you encounter any more bugs, so I can fix them! πŸ˜„

I'm closing this issue, since your problem was solved πŸ™‚

from greed.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.