1

When I run my python script, it gives me the following error. Not sure how to resolve it. I think so either the problem is in the version of python, I am using python 3.6 or It could be some packages not included. Please see the included image for error. Thanks. Error

Code:

f = open('c:\ExamCreator\My Project-9352ed298182.json') 
        key = f.read()
        f.close()                                                                             
        credentials = ServiceAccountCredentials(
             'CLIENT_EMAIL', key, 
             scope=
             'https://www.googleapis.com/auth/admin.directory.user', 
             sub='[email protected]'
        )
        http = httplib2.Http()
        http = credentials.authorize(http)                                           
        userinfo = {
            'primaryEmail': '[email protected]',
            'name': { 
                'givenName':'John','familyName':'Smith' 
            },
            'password': 'Hello1'
        }
        service = build("admin", "directory_v1", http=http)
        service.users().insert(body=userinfo).execute()
10
  • 2
    Post all relevant code and errors here directly as text. Commented Apr 4, 2018 at 22:13
  • do you have a variable called signer declared and assigned to a string? Commented Apr 4, 2018 at 22:14
  • Post the code and we can definitely start helping you! Commented Apr 4, 2018 at 22:16
  • Welcome to StackOverflow. Please read and follow the posting guidelines in the help documentation, as suggested when you created this account. Minimal, complete, verifiable example applies here. We cannot effectively help you until you post your MCVE code and accurately describe the problem. We should be able to paste your posted code into a text file and reproduce the problem you described. Commented Apr 4, 2018 at 22:29
  • 1
    @PeterDolan I have attached the code Commented Apr 4, 2018 at 22:30

1 Answer 1

0

It appears that signer is being interpreted as a string, which inherently is just...a string. Not a dict or a list, both of which have attrs. Please post the function that is throwing this error. Also, this SO question and answer may be relevant to your interests.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the response, but I am not making explicit calls to the sign method. Its being implicitly called by this code service = build("admin", "directory_v1", http=http)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.