GithubHelp home page GithubHelp logo

zipcodetw's Issues

Installation problem: No module named six

I tried to install zipcodetw, however, the installation failed due to No module named 'six' even if there is six in my requirements.txt. The code causing the problem is at line 7 of util.py. Is there any solution?

execute fail on colab

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

Remove unicodecsv from dependency for Python 3+

Currently, new installations in a clean virtualenv on Python 3.9.7 would result in the following error:

    File "/private/var/folders/…/zipcodetw/builder.py", line 23, in build
      dir_.load_chp_csv(csv_f)
    File "/private/var/folders/…/zipcodetw/util.py", line 317, in method_wrapper
      retval = method(self, *args, **kargs)
    File "/private/var/folders/…/zipcodetw/util.py", line 340, in load_chp_csv
      for row in csv.reader(lines_iter):
    File "/Users/…/zipcode_test/venv/lib/python3.9/site-packages/unicodecsv/py3.py", line 55, in __next__
      return self.reader.__next__()
    File "/Users/…/zipcode_test/venv/lib/python3.9/site-packages/unicodecsv/py3.py", line 51, in <genexpr>
      f = (bs.decode(encoding, errors=errors) for bs in f)
  AttributeError: 'str' object has no attribute 'decode'
  ----------------------------------------

Running pip remove unicodecsv && python -m zipcodetw.builder fixed the issue.

It appears that unicodecsv has been abandoned as in jdunck/python-unicodecsv#92, and thus no further maintenance are done for the package.

We could either:

  • drop the support for Python 2.7,
  • use the suggested csv backport from Python 3, or
  • specify unicodecsv as our dependency only when Python version < 3 as shown in PEP 0508.

The last one should be the easiest mitigation. Please let me know if a PR is preferred over issues.

sqlite3.OperationalError: unable to open database file

When I was running on .py file, everything went great. However, after converting my .py to .exe and executing the .exe file, it pops out the error message.

File "site-packages\zipcodetw\util.py", line 313, in method_wrapper
sqlite3.OperationalError: unable to open database file

Is there any solution?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.