DobyTang / LazyLibrarian

This project isn't finished yet. Goal is to create a SickBeard, CouchPotato, Headphones-like application for ebooks. Headphones is used as a base, so there are still a lot of references to it.
728 stars 72 forks source link

Fixed join command in requesters #1618

Closed jcal22 closed 5 years ago

jcal22 commented 5 years ago

' '.join(bookmatch["Requester"], book["dispname"])} was throwing errors.

2018-10-17 08:38:15 ERROR WEBSERVER searchrss.py search_wishlist 257 Unhandled exception in search_wishlist: Traceback (most recent call last): File "C:\LazyLibrarian\lazylibrarian\searchrss.py", line 80, in search_wishlist newValueDict = {"Requester": ' '.join(bookmatch["Requester"], book["dispname"])} TypeError: join() takes exactly one argument (2 given)

jcal22 commented 5 years ago

Yeah, I figured. The trailing space is ugly, but I couldn't figure out a cleaner way to iterate through the if-elif tree incase it wasn't empty, but didn't have the current wishlist it was looking to add.

philborman commented 5 years ago

The problem with the join command was that it needed to be passed a list, not two strings. Correct syntax is ' '.join([bookmatch["Requester"], book["dispname"]]) - note the extra square brackets. You could also add a .strip() to get rid of excess spaces ' '.join([bookmatch["Requester"].strip(), book["dispname"].strip()]) Depends how far you want to take it :-)