zipcodetw icon indicating copy to clipboard operation
zipcodetw copied to clipboard

execute fail on colab

Open momortk opened this issue 2 years ago • 1 comments

Hi, I try to use below code on colab:

try: import zipcodetw except ImportError: !pip install zipcodetw import zipcodetw

zipcodetw.find('臺北市信義區市府路1號')

but colab shows "util.py line 363, OperationalError: no such table: precise" Is any way to work on colab? Thanks.

more debug message: Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/ Collecting zipcodetw Downloading zipcodetw-0.6.8.tar.gz (592 kB) |████████████████████████████████| 592 kB 7.7 MB/s Requirement already satisfied: six in /usr/local/lib/python3.7/dist-packages (from zipcodetw) (1.15.0) Collecting unicodecsv Downloading unicodecsv-0.14.1.tar.gz (10 kB) Building wheels for collected packages: zipcodetw, unicodecsv Building wheel for zipcodetw (setup.py) ... done Created wheel for zipcodetw: filename=zipcodetw-0.6.8-py3-none-any.whl size=610897 sha256=8e8739c0bd79c942aaf817780ebf89acc61ad3d7a90bcd0c81cf3bd47b41cbb7 Stored in directory: /root/.cache/pip/wheels/37/03/5b/638651b1773a38a94b3a63284267f5bf248af9954dc617f8cd Building wheel for unicodecsv (setup.py) ... done Created wheel for unicodecsv: filename=unicodecsv-0.14.1-py3-none-any.whl size=10768 sha256=84c4ba5866616b0e6f7d2821a0cfce99c4dcd26e8a3a178974cdcf096aeb943d Stored in directory: /root/.cache/pip/wheels/1a/f4/8a/a5024fb77b32ed369e5c409081e5f00fbe3b92fdad653f6e69 Successfully built zipcodetw unicodecsv Installing collected packages: unicodecsv, zipcodetw Successfully installed unicodecsv-0.14.1 zipcodetw-0.6.8

OperationalError Traceback (most recent call last) in () 5 import zipcodetw 6 ----> 7 zipcodetw.find('臺北市信義區市府路1號')

2 frames /usr/local/lib/python3.7/dist-packages/zipcodetw/util.py in get_rule_str_zipcode_pairs(self, addr_str) 361 from precise 362 where addr_str = ?; --> 363 ''', (addr_str,)) 364 365 return self.cur.fetchall()

OperationalError: no such table: precise

momortk avatar Jun 01 '22 11:06 momortk

I just build the index and it fixes

python -m zipcodetw.builder

hsuan1117 avatar Jul 17 '22 15:07 hsuan1117