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.

ServiceAccount does not work correctly

See original GitHub issue

If you have a service account and you give access to it via the email. In this case, the file, when queried by drive looks like this:

{'id': 'some id here', 'name': 'some spreadheet name here'}]

This breaks here: https://github.com/aiguofer/gspread-pandas/blob/master/gspread_pandas/client.py#L256-L265

Since there is no parent, it raises an error, as it somehow expects said key to be there.

I hacked around that like this and it works:

    def _list_spreadsheet_files(self, q):
        files = self._query_drive(q)

        for f in files:
            try:
                parent = next(
                    d for d in self._dirs + [self._root] if d["id"] in f.get("parents", {})
                )
                f["path"] = parent.get("path", "/")
            except StopIteration:
                f["path"] = "/"

        return remove_keys_from_list(files, ["parents"])

I’m not really, really sure what I’m doing here, hence I didn’t make a PR. Happy to do so, if you think this would work.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
aiguofercommented, Jul 11, 2019

Btw, I just pushed a new version which should include all the aformentioned changes.

0reactions
aiguofercommented, Jul 11, 2019

Ahh, you were using your own scope I take it? I’ve added some checks now so it’ll still work and give you a message about the missing permissions (see https://github.com/aiguofer/gspread-pandas/commit/e8527fe56679088b333d66fa7c32c4a1e5b1db83).

Let me know if you have any other issues/suggestions/etc!

Read more comments on GitHub >

github_iconTop Results From Across the Web

The serviceaccount settings doesn't work, but ... - GitHub
Summary. I'm using WinSW with the YAML config format, and using serviceaccount does not work: image. But switching it to serviceAccount ...
Read more >
Troubleshoot IAM role issues with service accounts in Amazon ...
I try to use an AWS Identity and Access Management (IAM) role for a service account. But my Amazon Elastic Kubernetes Service (Amazon...
Read more >
Configure Service Accounts for Pods - Kubernetes
A service account provides an identity for processes that run in a Pod, and maps to a ServiceAccount object. When you authenticate to...
Read more >
GCP Service Account roles do not work correctly - Server Fault
So if I run the following: ``` gcloud projects add-iam-policy-binding PROJECT_ID \ --member serviceAccount:terraform@PROJECT_ID.iam.
Read more >
Pods in GKE return "error looking up service account"
We can resolve this error by rolebinding the service account with a new namespace. If the existing service account is in default namespace...
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