micahflee / semiphemeral

Automatically delete your old tweets, except for the ones you want to keep
MIT License
884 stars 85 forks source link

Several errors after i run semiphemeral unlike --filename ~/twitter/like.js #31

Closed Gerard64 closed 5 years ago

Gerard64 commented 5 years ago

I installed semiphemeral onto a ubuntu 18.04 virtualbox vm. then semiphemeral configure semiphemeral fresh semiphemeral delete

It did unliked 1661 from the 21.000

It did not find any tweets but i deleted already 12000 of the 13000 tweets with a other python script few days ago that might have something to do with it.

since i want to try to remove all my tweet and unlike all tweets i ever liked i downloaded my data and run:

root@Ubuntu-VirtualBox:~# semiphemeral unlike --filename ~/twitter/like.js
semiphemeral 0.4
WARNING: One does not simply unlike old tweets. According to the Twitter API, you didn't like these old tweets, so you can't unlike them -- even though they're listed in your like history. The only way to remove them from your like history is to LIKE THEM AGAIN, and then you can unlike them. This is very noisy. Every time you re-like a tweet, the user will get a notification.
Do you want to continue? [y/N]: y
Making a list of liked tweet status_ids
Like history has 21012 tweets
Loading tweets from database
Loaded 1662 tweets from database
Calculating tweets to fetch from the API
Fetching remaining 17902 tweets from API
Traceback (most recent call last):
  File "/usr/local/bin/semiphemeral", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/semiphemeral/__init__.py", line 75, in unlike
    t.unlike(filename)
  File "/usr/local/lib/python3.6/dist-packages/semiphemeral/twitter.py", line 404, in unlike
    tweet = Tweet(status)
  File "<string>", line 4, in __init__
  File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/state.py", line 441, in _initialize_instance
    manager.dispatch.init_failure(self, args, kwargs)
  File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/util/langhelpers.py", line 68, in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
  File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/util/compat.py", line 153, in reraise
    raise value
  File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/state.py", line 438, in _initialize_instance
    return manager.original_init(*mixed[1:], **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/semiphemeral/db.py", line 59, in __init__
    self.text = status.full_text
AttributeError: 'Status' object has no attribute 'full_text'
root@Ubuntu-VirtualBox:~#

By googling i found somebody who solved a similar error by installing pip install SQLAlchemy==1.2.5 SQLAlchemy-Utils==0.33.1

After that still the same errors. What is going wrong?

onmyouji commented 5 years ago

I also have some problem with unlike, but different error

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
micahflee commented 5 years ago

Hmm, @Gerard64 and @onmyouji I think you are both getting different errors, this doesn't look like it's the same thing.

@Gerard64 I think I know what the issue is, and I think I just fixed it in the 31_unlike_extended_tweets branch (really just this one-line change https://github.com/micahflee/semiphemeral/commit/1695bd9ed48284526af093063bca6cb157a5b75a). However since I already deleted all my old unlikes so it's difficult to test, would you be willing to test it for me?

To test you need to python3 and pipenv, and then:

# clone the repo and checkout the right branch
git clone https://github.com/micahflee/semiphemeral.git
cd semiphemeral
git fetch
git checkout 31_unlike_extended_tweets

# install dependencies
pipenv install --dev

# run semiphemeral from the source tree
pipenv run python ./app.py --help

Then try running the same unlike command, except using pipenv run python ./app.py instead of semiphemeral. If this works, I'll quickly make a new release so others don't hit this bug.

Gerard64 commented 5 years ago

I am testing it at this moment and it looks good no errors anymore. It is fetching tweets i think. i did not see any deletes/unlikes yet.

Schermafdruk van 2019-07-29 12-32-36 Schermafdruk van 2019-07-29 12-40-49

micahflee commented 5 years ago

Great, I think this fixed the problem then

Gerard64 commented 5 years ago

Reliked and unliked is working.

Problem solved! Great, thank you!

I am going to interrupt the app for now so i can stop the vm and run it tomorow again til all likes are removed.

62066129-c5e7fc00-b230-11e9-9614-932c5ec28b6e

onmyouji commented 5 years ago

@micahflee is there anything I can do to fix the "too many SQL variables" error or is this a bug on the program?