繁体   English   中英

gspread在Google电子表格上写入数据会给实时数据库带来错误

[英]gspread writing data on google spreadsheet gives error on live database

我已使用gspread在Google电子表格中写入数据。 它在本地工作正常,但是当我在实时服务器上尝试时,出现以下错误。

File "/home/openerp10/openerp_7.0/addons/spreadsheet_calculate_all/spreadsheet_calculate_all.py", line 53, in insert
a = c.open(title).sheet1
File "/usr/local/lib/python2.7/dist-packages/gspread-0.1.0-py2.7.egg/gspread/client.py", line 130, in open
raise SpreadsheetNotFound
SpreadsheetNotFound

代码如下

res_user = self.pool.get('res.users')
sale = self.browse(cr,uid,ids)[0]
username = res_user.browse(cr, uid, uid, context=context).gmail_user
passwd = res_user.browse(cr, uid, uid, context=context).gmail_password
title = sale.document
if title and username and passwd:
    try:
        c = gspread.Client(auth=(username,passwd))
        c.login()
        a = c.open(title).sheet1
    except Exception, e:
        raise osv.except_osv(_('User Error!'), _('Please give correct google username,password and document title.'))

请给我任何解决方案。

天哪,代码运行良好。 发生错误是由于电子表格名称不匹配。

我在销售订单中添加了字段,该字段将char作为电子表格的名称。

如果字段值和Google Spreadsheet Name不相同,则会出现上述错误。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM