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
I didn't run the add_team_to_github.py script directly, I was copy+pasting and running code line-by-line to slowly see what each step was doing. So this issue could just be a me problem.
The last for loop in the original script was returning an AttributeError where the .invite() method did not exist for that particular object.
Somehow I was getting a shortteam objectc, not a team object.
Original for loop:
# use invite function to invite team from csv fileforusernameinteam_members.username.values:
try:
self.teams[team_name].invite(username)
except:
print(username, "failed to add to", team, "team")
My fix, using the .add_or_update_membership() method
importosimportgithub3fromgithub3importloginimportpandasaspdorg="DSCI-310"team='students-2022-23-w2'team_name=teamcanvas_data=pd.read_csv("/home/dan/SynologyDrive/work/ubc/2022-2023/w2/dsci-310/GitHub.com username survey Quiz Student Analysis Report - cleaned.csv")
team_members=canvas_data.loc[:, ["name", '5923110: Enter your GitHub.com username below.\n\nBe sure that:\n\nIt is the username (a combination of letters and numbers)\nNot an email address\nThe submitted text does not include line breaks, or more than one line.\n\nFor example, my GitHub username is:ttimbers']]
team_members.columns= ["name", "username"]
team_members["username"] =team_members["username"].str.strip().str.lower()
team_members.head()
token="XXXXXXXXXX"# log inself=login(token=token)
orgname=orgself.org=self.organization(orgname)
self.teams= {team.name : teamforteaminself.org.teams()}
self.teams# use 'students-2022-23-w2' in self.teamsteam_members.username.values# self.teams[team_name].add_or_update_membership("chendaniely-teaching")# use invite function to invite team from csv file# invite was for a team object, we currently have a shortteam object now# so we use add_or_update_membership()forusernameinteam_members.username.values:
try:
self.teams[team_name].add_or_update_membership(username)
print(f"{username:<20} SUCCESS, {team:>10}, team")
except:
print(f"{username:<20} FAILED, {team:>10}, team")
The text was updated successfully, but these errors were encountered:
I didn't run the
add_team_to_github.py
script directly, I was copy+pasting and running code line-by-line to slowly see what each step was doing. So this issue could just be a me problem.The last for loop in the original script was returning an
AttributeError
where the.invite()
method did not exist for that particular object.Somehow I was getting a
shortteam
objectc, not ateam
object.Original for loop:
My fix, using the
.add_or_update_membership()
methodMy full script for reference:
The text was updated successfully, but these errors were encountered: