scrapinghub / dateparser

python parser for human readable dates
BSD 3-Clause "New" or "Revised" License
2.55k stars 465 forks source link

monkeypatching seems broken and has misstakes #419

Closed RonnyPfannschmidt closed 4 years ago

RonnyPfannschmidt commented 6 years ago

https://github.com/scrapinghub/dateparser/blob/eb9614aca39ad9b4cc11ac84fb405af0f4a36b06/dateparser/utils/strptime.py#L24-L34

a) triggers

lib/python3.6/site-packages/dateparser/utils/strptime.py:26: ResourceWarning: unclosed file <_io.TextIOWrapper name='/usr/lib64/python3.6/_strptime.py' mode='r' encoding='utf-8'>
  'strptime_patched', *imp.find_module('_strptime')
 (/usr/lib64/python3.6/warnings.py:99)

b) seems to grab the strptime module instead of the calendar module for the patched calendar

noviluni commented 4 years ago

We started using importlib here: https://github.com/scrapinghub/dateparser/pull/513/files for Python > 3.3 and then the offending code was removed when we removed the Python2 support, so I will close this issue.

If you think it's not solved feel free to open it again. Thanks!