Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parsedatetime.Calendar() is broken in Python 2.7 #246

Open
bmw opened this issue Jun 1, 2020 · 3 comments
Open

parsedatetime.Calendar() is broken in Python 2.7 #246

bmw opened this issue Jun 1, 2020 · 3 comments

Comments

@bmw
Copy link

bmw commented Jun 1, 2020

I've reproduced it on other systems, but on Ubuntu 18.04 with Python 2.7.17:

$ virtualenv -p python2 venv
.Running virtualenv with interpreter /usr/bin/python2
New python executable in /tmp/tmp.QhBu6ZeQC4/venv/bin/python2
 Also creating executable in /tmp/tmp.QhBu6ZeQC4/venv/bin/python
.Installing setuptools, pkg_resources, pip, wheel.../venv/bin/activatedone.
$ . ./venv/bin/activate
$ pip install parsedatetime
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting parsedatetime
  Downloading parsedatetime-2.6.tar.gz (60 kB) 
     |████████████████████████████████| 60 kB 7.8 MB/s 
Building wheels for collected packages: parsedatetime
  Building wheel for parsedatetime (setup.py) ... done
  Created wheel for parsedatetime: filename=parsedatetime-2.6-py2-none-any.whl size=42548 sha256=01153f5e5803e6668f31d09c6eb5395ce8919b81be08c657ddf6980f4f9c42ff
  Stored in directory: /home/bmw/.cache/pip/wheels/be/c8/34/61dee0758e18e0d545f6cb9c055980aefde80bc4c9569067ee
Successfully built parsedatetime
Installing collected packages: parsedatetime
Successfully installed parsedatetime-2.6
$ python -c 'import parsedatetime; parsedatetime.Calendar()' 
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/tmp.QhBu6ZeQC4/venv/local/lib/python2.7/site-packages/parsedatetime/__init__.py", line 270, in __init__
    self.ptc = Constants()
  File "/tmp/tmp.QhBu6ZeQC4/venv/local/lib/python2.7/site-packages/parsedatetime/__init__.py", line 2381, in __init__
    self.locale = get_icu(self.localeID)
  File "/tmp/tmp.QhBu6ZeQC4/venv/local/lib/python2.7/site-packages/parsedatetime/pdt_locales/icu.py", line 56, in get_icu
    result['icu'] = icu = pyicu.Locale(locale)
AttributeError: 'module' object has no attribute 'Locale'
$

I'm assuming Python 2.7 is still supported by parsedatetime because I couldn't find anything stating Python 2.7 has been dropped and there is a Python 2 wheel.

@spier
Copy link

spier commented Jun 3, 2020

I can confirm that I am seeing the same issue:

AttributeError: 'module' object has no attribute 'Locale'

I my case I am seeing it while using csvkit, which is using parsedatetime. I filed an issue there to track the impact wireservice/csvkit#1081.

@tonyg
Copy link
Contributor

tonyg commented Jun 4, 2020

This is the same bug as #245. The commit that introduced the fault is 1883750.

tonyg added a commit to tonyg/parsedatetime that referenced this issue Jun 4, 2020
bmw added a commit to certbot/certbot that referenced this issue Jun 4, 2020
This PR upgrades Certbot pinned dependencies through `letsencrypt-auto-source/rebuild_dependencies.py` while taking into account the problems detected in #8035:
* `cryptography` is pinned to `2.8` to continue to support OpenSSL 1.0.1 on non-x86 ancient Linux distributions (RHEL 6 + Debian 8)
* `parsedatetime` is pinned to `2.5` because of an incompatibility with Python 2.7 (see bear/parsedatetime#246)
* `letsencrypt-auto-source/rebuild_dependencies.py` now takes into account the environment markers that are aded to `AUTHORITATIVE_CONSTRAINTS`: this is used for the `enum34` dependency, to not install it on Python 3.6+ and not break the distribution by swapping the built-in `enum` module during the setup of Certbot venv.

Fixes #8030

* Pin cryptography and parsedatetime

* Upgrade dependencies

* Remove authoritative constraint

* Upgrade dependencies

* Rebuild certbot-auto

* Update letsencrypt-auto-source/rebuild_dependencies.py

Co-authored-by: Brad Warren <[email protected]>

* Honor specific requirements in the AUTHORITATIVE_CONSTRAINTS

* Fix injection

* Update dependencies

* Update rebuild_dependencies.py

Co-authored-by: Brad Warren <[email protected]>
@mvhconsult
Copy link
Contributor

But.. this is Python 2.7. Most devs would drop support for it as there are only a few months left before it really dies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants