bear / parsedatetime

Parse human-readable date/time strings
Apache License 2.0
694 stars 105 forks source link

importing is failed #245

Closed miettal closed 3 years ago

miettal commented 4 years ago

in this file, a importing was failed in my environment. https://github.com/bear/parsedatetime/commits/master/parsedatetime/pdt_locales/icu.py

because in this context icu = icu.py caused by this commit. https://github.com/bear/parsedatetime/commit/18837504778c0dd41ae412bdf86eb81b1be7cdd7

tonyg commented 4 years ago

Me too.

Steps to reproduce:

$ virtualenv -p python2.7 env
$ . env/bin/activate
$ pip install parsedatetime==2.6
$ python
Python 2.7.17 (default, Jan 19 2020, 19:54:54) 
[GCC 9.2.1 20200110] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import parsedatetime.pdt_locales.icu as i
>>> i
<module 'parsedatetime.pdt_locales.icu' from '/home/tonyg/q/env/local/lib/python2.7/site-packages/parsedatetime/pdt_locales/icu.pyc'>
>>> i.pyicu
<module 'parsedatetime.pdt_locales.icu' from '/home/tonyg/q/env/local/lib/python2.7/site-packages/parsedatetime/pdt_locales/icu.pyc'>
>>> 

This shows that icu.py's variable pyicu resolves in fact to icu.py itself, rather than the real ICU library.

Running the same steps but using parsedatetime==2.5 yields None for i.pyicu.

tonyg commented 4 years ago

Simpler reproduction: pipenv --python 2.7 run python setup.py test from a git checkout.