evilhero / mylar

An automated Comic Book downloader (cbr/cbz) for use with SABnzbd, NZBGet and torrents
GNU General Public License v3.0
977 stars 172 forks source link

Error during Manual Search #1641

Closed BenBeyond closed 7 years ago

BenBeyond commented 7 years ago

Mylar Details: Mylar Version: development -- git build c4b12b21cddd43fadfa9cebcced9b5850d823c59. Python Version : 2.7.12

Error in Log: Uncaught exception: Traceback (most recent call last): File "/opt/mylar/mylar/logger.py", line 158, in new_run old_run(*args, *kwargs) File "/usr/lib/python2.7/threading.py", line 754, in run self.__target(self.args, **self.kwargs) File "/opt/mylar/mylar/webserve.py", line 1460, in queueissue foundcom, prov = search.search_init(ComicName, ComicIssue, ComicYear, SeriesYear, Publisher, issues['IssueDate'], storedate, IssueID, AlternateSearch, UseAFuzzy, ComicVersion, mode=mode, ComicID=ComicID, manualsearch=manualsearch, filesafe=ComicName_Filesafe, allow_packs=AllowPacks) File "/opt/mylar/mylar/search.py", line 260, in search_init findit = NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, Publisher, IssueDate, StoreDate, searchprov, send_prov_count, IssDateFix, IssueID, UseFuzzy, newznab_host, ComicVersion=ComicVersion, SARC=SARC, IssueArcID=IssueArcID, RSS="no", ComicID=ComicID, issuetitle=issuetitle, unaltered_ComicName=unaltered_ComicName, allow_packs=allow_packs) File "/opt/mylar/mylar/search.py", line 1609, in NZB_SEARCH searchresult = searcher(nzbprov, nzbname, comicinfo, entry['link'], IssueID, ComicID, tmpprov, newznab=newznab_host) File "/opt/mylar/mylar/search.py", line 2246, in searcher rcheck = rsscheck.torsend2client(ComicName, IssueNumber, comyear, link, nzbprov) File "/opt/mylar/mylar/rsscheck.py", line 1091, in torsend2client torrent_info = helpers.get_the_hash(filepath) File "/opt/mylar/mylar/helpers.py", line 2918, in get_the_hash metainfo = bencode.decode(torrent_file.read()) AttributeError: 'module' object has no attribute 'decode'

After reading through previous issues, I can confirm that I have tried shutting down Mylar, removing any .pyc files and can also confirm that bencode.py is in the /lib subdirectory.

evilhero commented 7 years ago

Is there a bencode.py file located in the mylar subdirectory? If there's one there, or a bencode.pyc file it will load those mistakingly.

What is the download method you're using that generates the error?

BenBeyond commented 7 years ago

The only bencode file I can find is bencode.py in the /lib subdirectory.

I am trying to download torrents with 32p.

evilhero commented 7 years ago

This is gonna sound strange, but can you open up the bencode.py file you have and compare it to the one on the github branch (just go to the github page and view the file in the /lib subfolder). I'm wondering if there's a remnant somewhere that it's loading up prior to it.

What's the client you're using for Torrents?

BenBeyond commented 7 years ago

I used a program called Winmerge to compare the files and they are identical. (not just size and lines, but down to the byte)

I have Mylar just dropping the torrent files into a watch Directory and let my torrent client do the rest from there.

evilhero commented 7 years ago

Weird, there's no reason why it wouldn't open it properly - unless you're running with the lib being located elsewhere or something.

If you go to the helpers.py file, do you see an 'import bencode' a few lines up from the one indicated in the logs (~line 2918)?

BenBeyond commented 7 years ago

yep, line 2915.

My python is nearly non-existence, but if this problem cropped up after the bencode.py file was moved, is there somewhere that needs to be updated with its new location?

I thought python imports only worked if the imported file was in the same directory, unless you do something fancy. Just a thought, and sorry in advance if I am totally wrong.

evilhero commented 7 years ago

Well that's just it - when this occurred initially all the problems brought forth were addressed in regards to the bencode module, so it probably is something local going on due to your install, but the question remains as to what is causing it.

As long as your Mylar.py file has been updating the 24th line or so where it does the sys.insert inserts the lib path into your python path so when it goes to import anything it will reference the lib location first, and then any other locations.

If you go to a python prompt outside of the mylar directory and just type 'import bencode' does it return an error? If you do the same command from within the lib or mylar subdirectory, any errors?

BenBeyond commented 7 years ago

Tested a little farther and found my problem, there was a rogue bencode.pyc in the /mylar subdirectory that was tripping helpers.py up.

Sorry for the hassle.