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.
732 stars 70 forks source link

ImportError: No module named _strptime #1375

Closed dkids closed 6 years ago

dkids commented 6 years ago

OSTPROCESS : postprocess.py:processDir:873 : Unhandled exception in processDir: Traceback (most recent call last): File "/Users/kids/src/LazyLibrarian-master/lazylibrarian/postprocess.py", line 840, in processDir when_snatched = time.strptime(book['NZBdate'], '%Y-%m-%d %H:%M:%S') ImportError: No module named _strptime

If it helps, this is where LL had submitted a book to Transmision that I manually removed because it had already been downloaded. (Situation: book with two authors, book cover has the other author as primary author, I manually marked as "Skipped" for this author (instead of "Snatched") but LL is remembering that it tried to download.)

03-May-2018 09:05:28 - ERROR :: POSTPROCESS : postprocess.py:getTorrentFiles:990 : Failed to get torrent files from TRANSMISSION for 1a36042e876a31b275b7e622df1d1729452ae01f: IndexError list index out of range 03-May-2018 09:05:28 - DEBUG :: POSTPROCESS : postprocess.py:processDir:410 : No files returned by TRANSMISSION for Dhonielle Clayton - Tiny Pretty Things (Tiny Pretty Things #1) LL.(18710209) 03-May-2018 09:05:28 - DEBUG :: POSTPROCESS : postprocess.py:processDir:475 : Found 1 file in /Users/kids/Downloads/Books 03-May-2018 09:05:28 - DEBUG :: POSTPROCESS : postprocess.py:processDir:484 : Looking for eBook Dhonielle Clayton - Tiny Pretty Things (Tiny Pretty Things #1) LL.(18710209) in /Users/kids/Downloads/Books 03-May-2018 09:05:28 - DEBUG :: POSTPROCESS : postprocess.py:processDir:685 : Snatched torznab Dhonielle Clayton - Tiny Pretty Things (Tiny Pretty Things #1) LL.(18710209) is not in download directory 03-May-2018 09:05:28 - DEBUG :: POSTPROCESS : postprocess.py:processDir:687 : Closest match (22%): /Users/kids/Downloads/Books/.DS_Store 03-May-2018 09:05:28 - INFO :: POSTPROCESS : postprocess.py:processDir:830 : 0 books/mags processed. 03-May-2018 09:05:28 - ERROR :: POSTPROCESS : postprocess.py:processDir:873 : Unhandled exception in processDir: Traceback (most recent call last): File "/Users/kids/src/LazyLibrarian-master/lazylibrarian/postprocess.py", line 840, in processDir when_snatched = time.strptime(book['NZBdate'], '%Y-%m-%d %H:%M:%S') ImportError: No module named _strptime

philborman commented 6 years ago

Seems your python time module doesn't include strptime? We use it to convert the Y m d etc into a seconds count so we can work out the age of the download. There are bound to be other ways of getting the same info, but surprised the existing one isn't working. What system/python version are you using? I can rewrite it, but need to know what options will work.

dkids commented 6 years ago

/usr/bin/env python loads python 2.7.15 from Homebrew (/usr/local/bin/python). I also have python3 available. I'm a little surprised that it's calling python2. OK, looks like Homebrew switched to having python3 as "python" (which I remembered) but they switched back to "python" being python2.

https://brew.sh/2018/01/19/homebrew-1.5.0/ announces switch https://brew.sh/2018/04/09/homebrew-1.6.0/ retracts switch https://www.python.org/dev/peps/pep-0394/ (call python2 or python3, eventually python will call python3 but not yet)

Python 2.7.15 (default, May 1 2018, 16:44:08) [GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.1)] on darwin Type "help", "copyright", "credits" or "license" for more information.

/usr/bin/env python3 Python 3.6.5 (default, Mar 30 2018, 06:41:53) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin

/usr/bin/env python2 Python 2.7.15 (default, May 1 2018, 16:44:08) [GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.1)] on darwin

philborman commented 6 years ago

Ok, thanks. Found some info on stackoverflow about _strptime having threading issues. I will rewrite to use datetime.strptime instead of time.strptime as this doesn't seem to cause problems.