scrapinghub / number-parser

Parse numbers written in natural language
BSD 3-Clause "New" or "Revised" License
108 stars 23 forks source link

After updating to 0.3.1, can no longer import number_parser #90

Closed cunningjames closed 1 year ago

cunningjames commented 1 year ago

Hello!

After updating to 0.3.1, I can no longer import the library. This happens because the VERSION file is not included in the built distribution, and the call to pkgutil.get_data() raises an error in that case. I'm not sure why, though, as it's in your MANIFEST.in.

In [1]: import number_parser
------------------------------------------------------------------------
FileNotFoundError                      Traceback (most recent call last)
Cell In[1], line 1
----> 1 import number_parser

File /opt/homebrew/anaconda3/envs/venv/lib/python3.10/site-packages/number_parser/__init__.py:6
      1 import pkgutil
      3 from number_parser.parser import (parse, parse_fraction, parse_number,
      4                                   parse_ordinal)
----> 6 __version__ = (pkgutil.get_data(__package__, "VERSION") or b"").decode("ascii").strip()
      8 del pkgutil

File /opt/homebrew/anaconda3/envs/venv/lib/python3.10/pkgutil.py:639, in get_data(package, resource)
    637 parts.insert(0, os.path.dirname(mod.__file__))
    638 resource_name = os.path.join(*parts)
--> 639 return loader.get_data(resource_name)

File <frozen importlib._bootstrap_external>:1073, in get_data(self, path)

FileNotFoundError: [Errno 2] No such file or directory: '/opt/homebrew/anaconda3/envs/venv/lib/python3.10/site-packages/number_parser/VERSION'

I'm on Python 3.10.9, number-parser-0.3.1, MacOS 13.2.1.

serhii73 commented 1 year ago

Thank you for reporting this issue. The new version is uploaded to PyPI.