Closed micahflee closed 5 years ago
Hi, thank you for your work.
I tried the new unlike command and I got this error:
Traceback (most recent call last):
File "c:\users\****\appdata\local\programs\python\python37\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\****\appdata\local\programs\python\python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\****\AppData\Local\Programs\Python\Python37\Scripts\semiphemeral.exe\__main__.py", line 9, in <module>
File "c:\users\****\appdata\local\programs\python\python37\lib\site-packages\click\core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "c:\users\****\appdata\local\programs\python\python37\lib\site-packages\click\core.py", line 717, in main
rv = self.invoke(ctx)
File "c:\users\****\appdata\local\programs\python\python37\lib\site-packages\click\core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\users\****\appdata\local\programs\python\python37\lib\site-packages\click\core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\users\****\appdata\local\programs\python\python37\lib\site-packages\click\core.py", line 555, in invoke
return callback(*args, **kwargs)
File "c:\users\****\appdata\local\programs\python\python37\lib\site-packages\semiphemeral\__init__.py", line 75, in unlike
t.unlike(filename)
File "c:\users\****\appdata\local\programs\python\python37\lib\site-packages\semiphemeral\twitter.py", line 336, in unlike
js_string = f.read()
File "c:\users\****\appdata\local\programs\python\python37\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 6092: character maps to <undefined>
I google the error message and since I'm not a programmer, I'm not sure if this is the correct solution, but after editing with open(filename)
to with open(filename, encoding='utf8')
in twitter.py, I don't get the errors anymore.
After that, the unlike command showed the yes or no confirmation. But after selecting yes, I got new error message:
Do you want to continue? [y/N]: y
Making a list of liked tweet status_ids
Like history has 30270 tweets
Loading tweets from database
Traceback (most recent call last):
File "C:\Users\****\AppData\Local\Programs\Python\Python37\lib\site-packages\sqlalchemy\engine\base.py", line 1244, in _execute_context
cursor, statement, parameters, context
File "C:\Users\****\AppData\Local\Programs\Python\Python37\lib\site-packages\sqlalchemy\engine\default.py", line 552, in do_execute
cursor.execute(statement, parameters)
sqlite3.OperationalError: too many SQL variables
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\****\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\****\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\****\AppData\Local\Programs\Python\Python37\Scripts\semiphemeral.exe\__main__.py", line 9, in <module>
File "C:\Users\****\AppData\Local\Programs\Python\Python37\lib\site-packages\click\core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "C:\Users\****\AppData\Local\Programs\Python\Python37\lib\site-packages\click\core.py", line 717, in main
rv = self.invoke(ctx)
File "C:\Users\****\AppData\Local\Programs\Python\Python37\lib\site-packages\click\core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Users\****\AppData\Local\Programs\Python\Python37\lib\site-packages\click\core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\****\AppData\Local\Programs\Python\Python37\lib\site-packages\click\core.py", line 555, in invoke
return callback(*args, **kwargs)
File "C:\Users\****\AppData\Local\Programs\Python\Python37\lib\site-packages\semiphemeral\__init__.py", line 75, in unlike
t.unlike(filename)
File "C:\Users\****\AppData\Local\Programs\Python\Python37\lib\site-packages\semiphemeral\twitter.py", line 385, in unlike
for tweet in self.common.session.query(Tweet).filter(Tweet.status_id.in_(like_status_ids)).order_by(Tweet.created_at.desc()).all():
File "C:\Users\****\AppData\Local\Programs\Python\Python37\lib\site-packages\sqlalchemy\orm\query.py", line 3174, in all
return list(self)
File "C:\Users\****\AppData\Local\Programs\Python\Python37\lib\site-packages\sqlalchemy\orm\query.py", line 3330, in __iter__
return self._execute_and_instances(context)
File "C:\Users\****\AppData\Local\Programs\Python\Python37\lib\site-packages\sqlalchemy\orm\query.py", line 3355, in _execute_and_instances
result = conn.execute(querycontext.statement, self._params)
File "C:\Users\****\AppData\Local\Programs\Python\Python37\lib\site-packages\sqlalchemy\engine\base.py", line 988, in execute
return meth(self, multiparams, params)
File "C:\Users\****\AppData\Local\Programs\Python\Python37\lib\site-packages\sqlalchemy\sql\elements.py", line 287, in _execute_on_connection
return connection._execute_clauseelement(self, multiparams, params)
File "C:\Users\****\AppData\Local\Programs\Python\Python37\lib\site-packages\sqlalchemy\engine\base.py", line 1107, in _execute_clauseelement
distilled_params,
File "C:\Users\****\AppData\Local\Programs\Python\Python37\lib\site-packages\sqlalchemy\engine\base.py", line 1248, in _execute_context
e, statement, parameters, cursor, context
File "C:\Users\****\AppData\Local\Programs\Python\Python37\lib\site-packages\sqlalchemy\engine\base.py", line 1466, in _handle_dbapi_exception
util.raise_from_cause(sqlalchemy_exception, exc_info)
File "C:\Users\****\AppData\Local\Programs\Python\Python37\lib\site-packages\sqlalchemy\util\compat.py", line 398, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=cause)
File "C:\Users\****\AppData\Local\Programs\Python\Python37\lib\site-packages\sqlalchemy\util\compat.py", line 152, in reraise
raise value.with_traceback(tb)
File "C:\Users\****\AppData\Local\Programs\Python\Python37\lib\site-packages\sqlalchemy\engine\base.py", line 1244, in _execute_context
cursor, statement, parameters, context
File "C:\Users\****\AppData\Local\Programs\Python\Python37\lib\site-packages\sqlalchemy\engine\default.py", line 552, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) too many SQL variables
[SQL: SELECT tweets.id AS tweets_id, tweets.created_at AS tweets_created_at, tweets.user_id AS tweets_user_id, tweets.user_screen_name AS tweets_user_screen_name, tweets.status_id AS tweets_status_id, tweets.lang AS tweets_lang, tweets.source AS tweets_source, tweets.source_url AS tweets_source_url, tweets.text AS tweets_text, tweets.in_reply_to_screen_name AS tweets_in_reply_to_screen_name, tweets.in_reply_to_status_id AS tweets_in_reply_to_status_id, tweets.in_reply_to_user_id AS tweets_in_reply_to_user_id, tweets.retweet_count AS tweets_retweet_count, tweets.favorite_count AS tweets_favorite_count, tweets.retweeted AS tweets_retweeted, tweets.favorited AS tweets_favorited, tweets.is_retweet AS tweets_is_retweet, tweets.is_deleted AS tweets_is_deleted, tweets.is_unliked AS tweets_is_unliked, tweets.exclude_from_delete AS tweets_exclude_from_delete, tweets.thread_id AS tweets_thread_id
FROM tweets
WHERE tweets.status_id IN (?, ?, ?
# I omit the output because there're too many #
?, ?, ?) ORDER BY tweets.created_at DESC]
[parameters: (1152600081692090374, 18749799567085568, 718891237219176448,
# I omit the output because there're too many #
718580911181180929, 709408041125453824, 718566750917304320)]
(Background on this error at: http://sqlalche.me/e/e3q8)
Fixes #4