guibacellar / TEx

Telegram Monitor
Apache License 2.0
325 stars 45 forks source link

Crash when Telegram Group has no Name #10

Closed guibacellar closed 1 year ago

guibacellar commented 1 year ago

Application fails on --load-groups command when a Group has no Username

File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1965, in _exec_single_context self.dialect.do_execute( File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 921, in do_execute cursor.execute(statement, parameters) sqlite3.IntegrityError: NOT NULL constraint failed: telegram_group.group_\tname The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/USER/python@3.10/3.10.12_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/local/USER/python@3.10/3.10.12_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/usr/local/lib/python3.10/site-packages/TEx/_main_.py", line 22, in sys.exit(TelegramMonitorRunner().main()) File "/usr/local/lib/python3.10/site-packages/TEx/runner.py", line 70, in main self.__execute_sequence(args, data, self.config['PIPELINE']['pipeline_sequence'].split('\n'), 'Pipeline') File "/usr/local/lib/python3.10/site-packages/TEx/runner.py", line 97, in __execute_sequence loop.run_until_complete( File "/usr/local/USER/python@3.10/3.10.12_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete return future.result() File "/usr/local/lib/python3.10/site-packages/TEx/modules/telegram_groups_scrapper.py", line 102, in run TelegramGroupDatabaseManager.insert_or_update(values) File "/usr/local/lib/python3.10/site-packages/TEx/database/telegram_group_database.py", line 66, in insert_or_update DbManager.SESSIONS['data'].execute( File "/usr/local/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2262, in execute return self._execute_internal( File "/usr/local/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2144, in _execute_internal result: Result[Any] = compile_state_cls.orm_execute_statement( File "/usr/local/lib/python3.10/site-packages/sqlalchemy/orm/bulk_persistence.py", line 1276, in orm_execute_statement result = conn.execute( File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1412, in execute return meth( File "/usr/local/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 516, in _execute_on_connection return connection._execute_clauseelement( File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1635, in _execute_clauseelement ret = self._execute_context( File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1844, in _execute_context return self._exec_single_context( File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1984, in _exec_single_context self._handle_dbapi_exception( File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2339, in _handle_dbapi_exception raise sqlalchemy_exception.with_traceback(exc_info[2]) from e File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1965, in _exec_single_context self.dialect.do_execute( File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 921, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.IntegrityError: (sqlite3.IntegrityError) NOT NULL constraint failed: telegram_group.group_\tname [SQL: INSERT INTO telegram_group (id, constructor_id, access_hash, group_\tname, title, fake, gigagroup, has_geo, restricted, scam, verified, participants_count, photo_id, photo_base64, photo_name, source) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)] [parameters: (123, 123, '-123', None, 'GROUP NAME', 0, 0, 0, 0, 0, 0, 61, 123, '/9j/4AAQSkZJRgABAQEAeAB4AAD/4gHbSUNDX1BST0ZJTEUAAQEAAAHLAAAAAAJAAABtbnRyUkdCIFhZWiAAAAAAAAAAAAAAAABhY3NwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAA9tYAA ... (38226 characters truncated) ... AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//2Q==', 'image.jpg', '+12345678904')] (Background on this error at: https://sqlalche.me/e/20/gkpj) zsh: segmentation fault sudo python3.10 -m TEx load_groups --config /\ts/memset/my_TEx_config.confi
guibacellar commented 1 year ago

Fixed on V0.2.14