TermFeed icon indicating copy to clipboard operation
TermFeed copied to clipboard

Issues deleting with "-D"

Open Gumnos opened this issue 8 years ago • 7 comments

To recreate

$ rm ~/.termfeed
$ mkvirtualenv tf
(tf)$ pip install termfeed
(tf)$ feed -t
AI
CS
GEEK
General
Python
Science
Stack
ML
News
Research
(tf)$ feed -t | sed '1,2d;s/^\s*//' | xargs -n 1 feed -D # this should delete all the feeds/topics
created ".termfeed.db" in /home/demo
Removed "AI" from your library.
created ".termfeed.db" in /home/demo
Removed "CS" from your library.
created ".termfeed.db" in /home/demo
Removed "GEEK" from your library.
created ".termfeed.db" in /home/demo
Default topic "General" cannot be removed.
created ".termfeed.db" in /home/demo
Removed "Python" from your library.
created ".termfeed.db" in /home/demo
Removed "Science" from your library.
created ".termfeed.db" in /home/demo
Removed "Stack" from your library.
created ".termfeed.db" in /home/demo
Removed "ML" from your library.
created ".termfeed.db" in /home/demo
Removed "News" from your library.
created ".termfeed.db" in /home/demo
Removed "Research" from your library.
(tf)$ feed -t
  AI
  CS
  GEEK
  General
  Python
  Science
  Stack
  ML
  News
  Research
(tf)$ feed -t ML
created ".termfeed.db" in /home/demo
ML resources:
  http://hunch.net/?feed=rss2
  http://research.microsoft.com/rss/downloads.xml
  http://mlg.eng.cam.ac.uk/?feed=rss2

Note that after deleting each of the topics/feeds with "-D" (I'm cool with "General" hanging around as the output does mention its sacred), the topics still exist and a sampling of them shows that the URLs weren't actually deleted from the feed.

Also, the debugging output mentions ~/.termfeed.db but the program actually uses/creates ~/.termfeed without the .db extension.

Gumnos avatar Oct 29 '15 21:10 Gumnos

Running the latest version, FWIW:

(tf)$ feed --version
created ".termfeed.db" in /home/demo
TermFeed 0.0.11 (with pleasure by: Aziz Alto)

Gumnos avatar Oct 29 '15 21:10 Gumnos

If I rename ~/.termfeed to ~/.termfeed.db it appears to work correctly (though if run with -D General it should still remove the feeds, even if doesn't remove the topic). But consistently determining the database-name seems to be the biggest issue.

Gumnos avatar Oct 30 '15 13:10 Gumnos

Thanks @Gumnos !! I guess shelve is not the best way to go, it creates different extensions on different platforms! ( http://stackoverflow.com/questions/16171833/why-does-the-shelve-module-in-python-sometimes-create-files-with-different-exten ). With current settings, OS X works ok but not Linux! someone else have reported a similar issue earlier. It might be better to replace the shelve file with something else ( json or pickle .. ), and easier to edit the library URLs. I will check it out soon.

iamaziz avatar Oct 31 '15 20:10 iamaziz

Based on what I saw, you don't actually need to know the resulting file-name for anything other than the print-debug message that you emit ("Creating .termfeed.db in {}") so my patch should at least not assume what the resulting file-name is. While I haven't tested it on other platforms, there was something like d.dict.db.get_dbname() that returned a tuple, the first element of which was the resulting file-name if you actually need it. I don't know if that is available on all of the anydbm back-ends, so you might check it there (it was on my local Debian Linux install).

Gumnos avatar Oct 31 '15 22:10 Gumnos

The quick fix for linux systems is to create a symbolic link ~/.termfeed.db which points to ~/.termfeed. One-liner: ln -s ~/.termfeed ~/.termfeed.db

Jeffrey-P-McAteer avatar Jan 08 '17 15:01 Jeffrey-P-McAteer

The quick fix for linux systems is to create a symbolic link ~/.termfeed.db which points to ~/.termfeed. One-liner: ln -s ~/.termfeed ~/.termfeed.db

Thank you very much for posting this :D

I've been trying to use TermFeed for a while, but I couldn't figure out why editing the urls wouldn't work. Now I'm able to use TermFeed as intended.

For some reason, using the above fix when TermFeed is installed through pip3, TermFeed spits out an error every time it's ran saying something about invalid db type. Installing TermFeed through just pip and using the above fix works great 👍

simoniz0r avatar Oct 21 '17 00:10 simoniz0r

For anyone who is running this on Windows 7, I have found that shelve generates a .dat file.

I am using MinGW so I can run Unix-like commands on my computer. The command that I used that worked for me was ln -s ~/.termfeed.dat ~/.termfeed.db

Hope this helps someone!

michealodwyer26 avatar Dec 27 '17 19:12 michealodwyer26