You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
'User' object has no attribute 'populate_groups' #808
Yes, I'll be glad to. FYI, I used pip on a windows pc to install TSC, which is version 0.14.1
here is the snippet
with server.auth.sign_in(src_tbl_auth):
do_run = input('\nList Projects?: ') or 'no'
if do_run[0] == 'y':
projects = list(TSC.Pager(server.projects, request_options))
print(f'\n\nProjects:\n---------\n{"name":30s}\t{"description":60s}\t{"id":40s}\t{"parent_id":40s}\t{"content_permissions"}')
print(f'{"-"*30}\t{"-"*60}\t{"-"*40}\t{"-"*40}')
for prj in projects:
print(f"{prj.name:30s}\t{prj.description and prj.description[:59] or '':60s}\t{prj.id:40s}\t{prj.parent_id or '':40s} ({type(prj.parent_id)})\t{prj.content_permissions}")
prj_lkp[prj.id] = prj.name
#print(prj_lkp)
do_run = input('\nList Users?: ') or 'no'
if do_run[0] == 'y':
users = list(TSC.Pager(server.users, request_options))
print(f'\n\nUsers:\n----------\n{"name":40s}\t{"domain_name":20s}\t{"id":40s}\t{"auth_setting":30s}\t{"email":30s}\t{"fullname":30s}\t{"site_role":30s}\t{"last_login":30s}\t{"groups":10s}\t{"workbooks":10s}')
print(f'{"-"*40}\t{"-"*20}\t{"-"*40}\t{"-"*30}\t{"-"*30}\t{"-"*30}\t{"-"*30}\t{"-"*30}\t{"-"*30}\t{"-"*30}')
for usr in users:
page_n = server.users.populate_groups(usr)
print(page_n.total_available)
server.users.populate_workbooks(usr)
wbks = [workbook.name for workbook in usr.workbooks]
print(f"{usr.name:40s}\t{usr.domain_name or '':20s}\t{usr.id:40s}\t{usr.auth_setting or '':30s}\t{usr.email or '':30s}\t{usr.fullname or '':30s}\t{usr.site_role or '':30s}\t{usr.last_login or ''}\t{len(page_n.total_available) or 0:10}\t{len(wbks) or 0:10}")
@pablo-vivanco thanks for the sample code. I was able to reproduce your problem and realized the issue - the populate_groups() capability was added in release 0.15 (via #799). If you upgrade to that version (pip install --upgrade tableauserverclientI believe your script should work now.
@pablo-vivanco thanks for the sample code. I was able to reproduce your problem and realized the issue - the populate_groups() capability was added in release 0.15 (via #799). If you upgrade to that version (pip install --upgrade tableauserverclientI believe your script should work now.
I was having the same issue and this initially solved it. But now I'm running into a separate issue:
When running this snippet
`
with server.auth.sign_in(tableau_auth):
all_users, pagination_item = server.users.get()
print("\nThere are {} user on site: ".format(pagination_item.total_available))
print([user.name for user in all_users])
page_n = server.users.populate_groups(all_users[0])
print("\nUser {0} is a member of {1} groups".format(all_users[0].name, page_n.total_available))
print("\nThe groups are:")
for group in all_users[0].groups :
print(group.name)`
I receive
`AttributeError Traceback (most recent call last)
in
4 print([user.name for user in all_users])
5 page_n = server.users.populate_groups(all_users[0])
----> 6 print("\nUser {0} is a member of {1} groups".format(all_users[0].name, page_n.total_available))
7 print("\nThe groups are:")
8 for group in all_users[0].groups :
AttributeError: 'NoneType' object has no attribute 'total_available'`
Activity
bcantoni commentedon Feb 24, 2021
@pablo-vivanco could you include a code snippet showing what you are trying?
From the description you mentioned
user, but the populate groups method only works onusersobject (plural), so maybe that's the issue.The example shown here could be helpful:
https://tableau.github.io/server-client-python/docs/api-ref#userspopulate_groups
pablo-vivanco commentedon Feb 28, 2021
Hi bcantoni.
Yes, I'll be glad to. FYI, I used pip on a windows pc to install TSC, which is version 0.14.1
here is the snippet
[-]'User' object has not attribute 'populate_groups[/-][+]'User' object has no attribute 'populate_groups'[/+]bcantoni commentedon Mar 4, 2021
@pablo-vivanco thanks for the sample code. I was able to reproduce your problem and realized the issue - the
populate_groups()capability was added in release 0.15 (via #799). If you upgrade to that version (pip install --upgrade tableauserverclientI believe your script should work now.patawan commentedon Apr 22, 2021
I was having the same issue and this initially solved it. But now I'm running into a separate issue:
When running this snippet
`
with server.auth.sign_in(tableau_auth):
all_users, pagination_item = server.users.get()
I receive
`AttributeError Traceback (most recent call last)
in
4 print([user.name for user in all_users])
5 page_n = server.users.populate_groups(all_users[0])
----> 6 print("\nUser {0} is a member of {1} groups".format(all_users[0].name, page_n.total_available))
7 print("\nThe groups are:")
8 for group in all_users[0].groups :
AttributeError: 'NoneType' object has no attribute 'total_available'`
bcantoni commentedon Apr 23, 2021
@patawan if you don't mind, since that's a separate issue could you create a new issue with those details? Then I'll close this one out.
patawan commentedon Apr 23, 2021
@bcantoni for sure - just created a new one
bcantoni commentedon Apr 23, 2021
Great - we'll continue that conversation over in new issue #837 and will consider this one closed.