- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试使用 gspread 连接到我的 Google 表格。这是代码:
#IMPORT STANDARD LIBRARIES
import json
import os
#IMPORT THIRD PARTY LIBRARIES
import gspread
from oauth2client.client import SignedJwtAssertionCredentials
key_location = '/home/selecaotwo/Dropbox/Public/my.ENV/' + os.sep + 'sys.CREDENTIALS'
key_file_h = 'test-project-auth-a4f3c4bd20c4.json'
print key_location + os.sep + key_file_h
json_key = json.load(open(key_location + os.sep + key_file_h))
scope = ['https://spreadsheets.google.com/feeds']
credentials = SignedJwtAssertionCredentials(json_key['client_email'], json_key['private_key'], scope)
gc = gspread.authorize(credentials)
运行此代码会出现以下错误:
/home/selecaotwo/Dropbox/Public/my.ENV//sys.CREDENTIALS/test-project-auth-a4f3c4bd20c4.json
Traceback (most recent call last):
File "/home/selecaotwo/Desktop/gspread-test/gspread-test-001-codeRegist-0001.py", line 17, in <module>
gc = gspread.authorize(credentials)
File "/usr/local/lib/python2.7/site-packages/gspread/client.py", line 335, in authorize
client.login()
File "/usr/local/lib/python2.7/site-packages/gspread/client.py", line 98, in login
self.auth.refresh(http)
File "build/bdist.linux-x86_64/egg/oauth2client/client.py", line 598, in refresh
File "build/bdist.linux-x86_64/egg/oauth2client/client.py", line 769, in _refresh
File "build/bdist.linux-x86_64/egg/oauth2client/client.py", line 795, in _do_refresh_request
File "build/bdist.linux-x86_64/egg/oauth2client/client.py", line 1425, in _generate_refresh_request_body
File "build/bdist.linux-x86_64/egg/oauth2client/client.py", line 1554, in _generate_assertion
File "build/bdist.linux-x86_64/egg/oauth2client/crypt.py", line 162, in from_string
File "/usr/local/lib/python2.7/site-packages/OpenSSL/__init__.py", line 36, in <module>
from OpenSSL import crypto
ImportError: /usr/local/lib/python2.7/site-packages/OpenSSL/crypto.so: undefined symbol: PyUnicodeUCS2_Decode
[Finished in 0.1s with exit code 1]
[shell_cmd: python -u "/home/selecaotwo/Desktop/gspread-test/gspread-test-001-codeRegist-0001.py"]
[dir: /home/selecaotwo/Desktop/gspread-test]
[path: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin]
我在论坛上读到,这可能是我的 Ubuntu 系统(14.04 LTS)和 Python(2.7.9)之间的问题,但奇怪的是,当我使用 --enable-encoding=usc2 重新编译 python 时,我得到了同一行上有相同的错误,但不是说“ undefined symbol :PyUnicodeUCS2_Decode”,而是简单地说“ undefined symbol :PyUnicodeUCS4_Decode”。这让我相信问题可能是其他原因,而且我不知道如何继续。
最佳答案
我不确定这是否能解决问题。您可以尝试像这样输入 client_email 和私钥,而不是放入 json 文件本身。client_email 可以这样复制。对于私钥,请执行以下操作:
key = u"-----BEGIN PRIVATE KEY-----\nBLABLA_\n-----END PRIVATE KEY-----\n".encode("utf-8")
credentials = SignedJwtAssertionCredentials(client_email,key,scope)
关于python - undefined symbol : PyUnicodeUCS2_Decode,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30349340/
我只是有一个更琐碎的问题。 为什么undefined == undefined 返回true,而undefined >= undefined 为false? undefined 等于 undefine
用PHP 7.2编写套接字服务器。根据Firefox 60中的“网络”选项卡,服务器的一些HTTP响应的第一行随机变为undefined undefined undefined。因此,我尝试记录套接字
在 JavaScript 中这是真的: undefined == undefined 但这是错误的: undefined <= undefined 起初我以为<=运算符包含第一个,但我猜它试图将其转换
在回答这个问题 (Difference between [Object, Object] and Array(2)) 时,我在 JavaScript 数组中遇到了一些我以前不知道的东西(具有讽刺意味的
来自https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/of , Note: thi
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
当我添加 到我的 PrimeFaces Mobile 页面,然后我在服务器日志中收到以下警告 WARNING: JSF1064: Unable to find or serve resource, u
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我是一名优秀的程序员,十分优秀!