I'm working on windows with python 3.7.2 and using uszipcode
library and import SearchEngine for getting a list of zip codes which start with the argument of the function.
I'm getting the following errors:
Traceback (most recent call last): File "C:\Users\user\Anaconda3\lib\site-packages\sqlalchemy\dialects\sqlite\pysqlite.py", line 338, in dbapi from pysqlite2 import dbapi2 as sqlite ModuleNotFoundError: No module named 'pysqlite2'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:/Users/user/PycharmProjects/tutorial/tutorial/Zillow/zillow_runfile.py", line 38, in <module> st = zl.zipcodes_list(st_items=["100", "770"]) File "C:\Users\user\PycharmProjects\tutorial\tutorial\Zillow\zillow_functions.py", line 32, in zipcodes_list search = SearchEngine() File "C:\Users\user\Anaconda3\lib\site-packages\uszipcode\search.py", line 82, in __init__ engine = connect_to_simple_zipcode_db() File "C:\Users\user\Anaconda3\lib\site-packages\uszipcode\db.py", line 49, in connect_to_simple_zipcode_db return engine_creator.create_sqlite(path=simple_db_file_path.abspath) File "C:\Users\user\Anaconda3\lib\site-packages\uszipcode\pkg\sqlalchemy_mate\engine_creator.py", line 51, in create_sqlite return create_engine(_create_sqlite(path), **kwargs) File "C:\Users\user\Anaconda3\lib\site-packages\sqlalchemy\engine\__init__.py", line 423, in create_engine return strategy.create(*args, **kwargs) File "C:\Users\user\Anaconda3\lib\site-packages\sqlalchemy\engine\strategies.py", line 87, in create dbapi = dialect_cls.dbapi(**dbapi_args) File "C:\Users\user\Anaconda3\lib\site-packages\sqlalchemy\dialects\sqlite\pysqlite.py", line 343, in dbapi raise e File "C:\Users\user\Anaconda3\lib\site-packages\sqlalchemy\dialects\sqlite\pysqlite.py", line 341, in dbapi from sqlite3 import dbapi2 as sqlite # try 2.5+ stdlib name. File "C:\Users\user\Anaconda3\lib\sqlite3\__init__.py", line 23, in <module> from sqlite3.dbapi2 import * File "C:\Users\user\Anaconda3\lib\sqlite3\dbapi2.py", line 27, in <module> from _sqlite3 import * ImportError: DLL load failed: entry module not found.
I've tried to install different libraries according to recommendations I found online:
- pip install sqlite-devel
- pip install sqlite3tools
- pip install libsqlite3-dev
for each of the above I got the following error:
Could not find a version that satisfies the requirement "sqlite-devel <from versions: > No matching distribution found for "sqlite-devel"
def zipcodes_list(st_items):
search = SearchEngine()
# If st_items is a single zipcode string.
if isinstance(st_items, str):
zc_objects = search.by_prefix(st_items)
# If st_items is a list of zipcode strings.
elif isinstance(st_items, list):
zc_objects = [n for i in st_items for n in search.by_prefix(str(i))]
else:
raise ValueError("arg 'st_items' must be of type str or list")
output = [str(i).split(" ", 1)[1].split(">")[0] for i in zc_objects]
return output