我正在使用Python 2.7,试图运行本地服务器版本的Plaid,以将我的银行帐户余额提取到我的帐单电子表格中。我一直在与UnicodeDecodeError
竞争,但我想不通。
我试图找出问题所在,并使用Unicode标识符修复它们。在调试模式下运行时,在PLAID_ENV
,PLAID_PRODUCTS
和python行上出现语法错误。我试过在server.py
前面没有python的情况下运行。
PLAID_CLIENT_ID='5bf874c39bb5dc0012b1be13' \
PLAID_SECRET='*Redacted because secret*' \
PLAID_PUBLIC_KEY='8a2fc8ffb6c20e69159eded19cf77f' \
PLAID_ENV=‘development’ \
PLAID_PRODUCTS=‘balance’ \
PLAID_COUNTRY_CODES='US,CA,GB,FR,ES' \
python server.py
这是我尝试导航至127.0.0.1:5000时得到的输出:
[2019-10-01 10:54:57,573] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/flask/app.py", line 2446, in wsgi_app
response = self.full_dispatch_request()
File "/Library/Python/2.7/site-packages/flask/app.py", line 1951, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Library/Python/2.7/site-packages/flask/app.py", line 1820, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/Library/Python/2.7/site-packages/flask/app.py", line 1949, in full_dispatch_request
rv = self.dispatch_request()
File "/Library/Python/2.7/site-packages/flask/app.py", line 1935, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "server.py", line 43, in index
plaid_country_codes=PLAID_COUNTRY_CODES,
File "/Library/Python/2.7/site-packages/flask/templating.py", line 140, in render_template
ctx.app,
File "/Library/Python/2.7/site-packages/flask/templating.py", line 120, in _render
rv = template.render(context)
File "/Library/Python/2.7/site-packages/jinja2/environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "/Library/Python/2.7/site-packages/jinja2/environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "/Users/siekmang/quickstart/python/templates/index.ejs", line 244, in top-level template code
countryCodes: '{{ plaid_country_codes }}'.split(','),
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0: ordinal not in range(128)