From 7182f45c98a2f3c2dc346d338b060be739f5d4b9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 27 Nov 2010 10:07:00 -0700 Subject: [PATCH] Fix #7694 (Calibre-parallel.exe stopped working error: downlaoding NY Times) --- src/calibre/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/__init__.py b/src/calibre/__init__.py index a43b0126ff..6e39f56266 100644 --- a/src/calibre/__init__.py +++ b/src/calibre/__init__.py @@ -362,6 +362,8 @@ def walk(dir): def strftime(fmt, t=None): ''' A version of strftime that returns unicode strings and tries to handle dates before 1900 ''' + if not fmt: + return u'' if t is None: t = time.localtime() if hasattr(t, 'timetuple'): @@ -378,7 +380,8 @@ def strftime(fmt, t=None): if isinstance(fmt, unicode): fmt = fmt.encode('mbcs') ans = plugins['winutil'][0].strftime(fmt, t) - ans = time.strftime(fmt, t).decode(preferred_encoding, 'replace') + else: + ans = time.strftime(fmt, t).decode(preferred_encoding, 'replace') if early_year: ans = ans.replace('_early year hack##', str(orig_year)) return ans