question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

open_by_url silently failing

See original GitHub issue

I recently upgraded from gspread 0.6.2 to 3.1.0. According to the docs, open_by_url should raise an exception if the spreadsheet is not found; I noticed that it does not. Instead, the command runs without error and appears to get set to spreadsheet instance which has the following output.

(Pdb) ss = self._client.open_by_url('http://docs.google.com/spreadsheets/d/foobar')
(Pdb) print(ss)
*** gspread.exceptions.APIError: {
  "error": {
    "code": 404,
    "message": "Requested entity was not found.",
    "status": "NOT_FOUND"
  }
}

Here, the ss variable is set showing that an exception was never raised. This is causing my exception handler for exponential backoff to be completely bypassed.

Environment Info

Operating System: Mac OSX 10.13.6 High Sierra Python version: 3.7.1 gspread version: 3.1.0

Steps to reproduce

  1. c = gspread.authorize(self._credentials)
  2. ss = c.open_by_url(‘http://docs.google.com/spreadsheets/d/foobar’)

Observations

  • The ss variable is getting set showing that no exception was raised.
  • The output of ss shows an exception but it was never raised:
(Pdb) print(ss)
*** gspread.exceptions.APIError: {
  "error": {
    "code": 404,
    "message": "Requested entity was not found.",
    "status": "NOT_FOUND"
  }
}
  • Note that it would be nice if open_by_key raised an exception as well (it too does not)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

3reactions
leaheincommented, Feb 18, 2020

I am experiencing the same issue for open_by_key on version 3.2.0. Is there a fix for this?

2reactions
zachliucommented, Feb 19, 2020

I just checked the source code, this thing should be easy to fix

Read more comments on GitHub >

github_iconTop Results From Across the Web

SpreadsheetApp.openByUrl and openById give errors
This error is due to a change Google recently rolled out prohibiting the use of SpreadsheetApp.openByUrl() (or SpreadsheetApp.openById() in custom functions ...
Read more >
Script "fails" without any logs or errors - Google Groups
I have a script that, after switching to the new Scripts experience, runs for about 5 seconds, and then finishes /fails, but without...
Read more >
Unexpected "authorization is required" error from google.script ...
does anyone have a code workaround for this even? a way to detect that the user is going to fail the request. silently...
Read more >
Import online excel file in google spreadsheet - Edureka
... catch(e){} // fail silently if no such folder id exists in Drive ... openByUrl("https://docs.google.com/document/d/[My document ...
Read more >
Re: How to Integrate Google Apps Script & Trigger
Executing a DeepLink action from an Email Silently Tips & Tricks. [STRUCTURE AND THE APP BUILD] I will try to explain briefly but...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found