Closed cloudadikt closed 1 year ago
Is this a new install, or a previously working install? Is the issue repeatable or a one-off?
The error suggests the list of group names read from SCM is invalid, which is odd.
It will most likely be a problem in the configuration file. My guess is the config file references a group that is not in SCM. Have you recently edited the config file? Have you recently edited Groups in SCM?
Thank you for replying so quickly. It's a new install with a new config and repeatable. I've removed (commented out) all groups apart from one under Groups and under what is referenced under Lists with the same result.
Hmm.
There are 3 possibilities. 1) SCM is not returning Group data, but the print out suggests 39 groups have been read. 2) The config is causing issues, but this should flag earlier on. 3) The is something in your environment that is different to mine!
For 2) Could you please supply a copy of your configuration file? For 3) Are you running the binary executable file, or are you running the Python version? If python, which version?
Hi, this is running on my Mac via Python 3.11.3 with all the necessary libraries.
Here is the config:
#############################################
# Configuration of SCM-Validator
# Darren WHitt
# May 2023
#
#############################################
# Your swimming club name.
club: "Winchester City Penguins Swimming Club"
allow_update: False # Set to true if this tool is allowed to edit SCM
# Set to false if you don't trust the software to be reliable.
#############################################
# Email config
#############################################
email:
smtp_server: smtp.server.net
smtp_port: 25
username: someone@somewhere.com
send_to: someone@gmail.com
tls: False
password: "email.enc"
#############################################
# File input, for correlation
#############################################
files:
"swim_england.csv":
check_se_number: true
mapping:
Firstname: 'First Name'
Lastname: 'Surname'
# KnownAs: 'Known As'
ASANumber: 'Member ID'
# Gender: 'Gender'
# ASACategory: 'Category'
DOB: 'Date of Birth'
dob_format: '%Y/%m/%d'
#############################################
# Configure Swimmer Checks
#############################################
swimmers:
username:
min_age: 17 # Min age to have a user name
parent:
mandatory: True
max_age: 17 # Age a parent is mandatory until
confirmation_difference:
verify: True # if there is > 3 month differnence in confirm date
# between parent and child, report an issue.
absence:
time: 182 # Warn if not seen at swimming for this period of time
#############################################
# Configure Parent Checks
#############################################
parents:
age:
min_age: 17 # min age to be a parent
child: 21 # Age at which child should not longer have a parent
login:
mandatory: True # must have a login to SCM
#############################################
# Configure Member Checks
#############################################
members:
confirmation:
expiry: 365
align_quarter: True # Align expiry to calender quarter
# So reminders go in batches.
dbs:
expiry: 60 # Days waring prior to expiry.
newstarter:
grace: 90 # Don't give errors for 90 days, giving admin time to sort it all out
inactive:
time: 365 # Warn if member in inactive state for this many days
#############################################
# Configure Coaches
#############################################
coaches:
role:
mandatory: True # All coaches, must be in a coach role
#############################################
# Configure Roles
#############################################
roles:
volunteer:
mandatory: True
login:
unused: 180 # Error if not used in 180 days
role:
"Head Coaches":
check_permissions: False
is_coach: True # Should have "Is A Coach" ticked.
"Coaches":
check_permissions: True
is_coach: True # Should have "Is A Coach" ticked.
"Lessons Head Teacher":
check_permissions: False
is_coach: True # Should have "Is A Coach" ticked.
"Lessons Level 1 Teacher":
check_permissions: True
is_coach: True # Should have "Is A Coach" ticked.
"Lessons Level 2 Teacher":
check_permissions: True
is_coach: True # Should have "Is A Coach" ticked.
#"Squad Rep":
# check_permissions: True
#"Register Taker":
# check_restrictions: True # Check they have session restrictions
#############################################
# Configure Groups
#############################################
groups:
priority: # If a user is in multiple groups - these take priority (in this order)
- 'Masters'
group:
#'Membership Only':
# no_sessions: true
#
# Squads
'Advanced Development':
type: swimmer
# 'Age Group Squad':
# type: swimmer
# 'Bronze':
# type: swimmer
# 'Distance':
# type: swimmer
# 'Gold':
# type: swimmer
# 'Intermediate Development':
# type: swimmer
# 'Junior Development':
# type: swimmer
# 'Junior Squad':
# type: swimmer
# 'Masters':
# type: swimmer
# min_age: 18
# 'National Squad':
# type: swimmer
# 'Silver':
# type: swimmer
# 'University':
# type: swimmer
# 'Winch-Centric':
# type: swimmer
# 'Young Advanced':
# type: swimmer
# 'Youth Squad':
# type: swimmer
# # Learn to swim
# 'LTS Adult':
# type: swimmer
# max_sessions: 2
# sessions:
# - 'LTS'
# 'LTS Little Penguins':
# type: swimmer
# max_sessions: 2
# sessions:
# - 'LTS'
# 'LTS Stage 1':
# type: swimmer
# max_sessions: 2
# sessions:
# - 'LTS'
# 'LTS Stage 2':
# type: swimmer
# max_sessions: 2
# sessions:
# - 'LTS'
# 'LTS Stage 3':
# type: swimmer
# max_sessions: 2
# sessions:
# - 'LTS'
# 'LTS Stage 4':
# type: swimmer
# max_sessions: 2
# sessions:
# - 'LTS'
# 'LTS Stage 5':
# type: swimmer
# max_sessions: 2
# sessions:
# - 'LTS'
# 'LTS Stage 6':
# type: swimmer
# max_sessions: 2
# sessions:
# - 'LTS'
# 'LTS Stage 7':
# type: swimmer
# max_sessions: 2
# sessions:
# - 'LTS'
# 'LTS Stage 8':
# type: swimmer
# max_sessions: 2
# sessions:
# - 'LTS'
# 'LTS Stage 9':
# type: swimmer
# max_sessions: 2
# sessions:
# - 'LTS'
# 'LTS Stage 10':
# type: swimmer
# max_sessions: 2
# sessions:
# - 'LTS'
# # Teachers and lessons helpers
# "Level 1 Swim Teacher":
# check_dbs: true
# min_age: 16
# # login: true
# 'Level 2 Swim Teacher':
# check_dbs: True
# min_age: 16
# # login: true
# 'Lessons Helper':
# min_age: 14
# # Other
# 'Lifeguards':
# check_dbs: true
# min_age: 16
# 'Officials':
# type: volunteer
# unique: False
#'Team Manager':
# check_dbs: true
# type: volunteer
# unique: False
#'Duty Parent':
# check_dbs: True
# type: volunteer
# unqiue: false
#############################################
# Configure Sessions
#
# Sessions not listed will not be checked
#############################################
sessions:
absence: 120 # Number of days allowed to miss a sesssion
register: 60 # Alert if register not taken for this many days
#session:
# 'Club Session':
# groups:
# - 'Development'
#############################################
# Codes of Conduct
#############################################
conduct:
"WCPSC Code of Conduct for Coaches and Teachers":
types:
- "coach"
"WCPSC Code of Conduct for Trustees, Officials and Volunteers":
types:
- "volunteer"
- "committee"
"WCPSC Code of Conduct for Parents / Guardians":
types:
- "parent"
"WCPSC Code of Conduct for Swimmers":
types:
- "swimmer"
ignore_group:
- "LTS Little Penguins"
#"Data Protection":
# types:
# - "coach"
#############################################
# Facebook Correlations
#############################################
facebook:
# files:
# - "Nottingham Leander Swimmers.html"
# - "Nottingham Leander Masters.html"
# - "Nottingham Leander Water Polo.html"
groups:
- https://www.facebook.com/groups/wcpsc.admin/
#############################################
# Lists
#
# Configure the criteria for auto-generated lists
#
#############################################
lists:
suffix: " (Generated)" # Use to identity generated lists
edit: True # Allow script to modify generated lists
confirmation: True # Generate lists of non-confirmed and expired confirmation members
conduct:
- "WCPSC Code of Conduct for Coaches and Teachers"
- "WCPSC Code of Conduct for Parents / Guardians"
- "WCPSC Code of Conduct for Swimmers"
- "WCPSC Code of Conduct for Trustees, Officials and Volunteers"
list:
"Club wide distribution":
group:
- "Advanced Development"
# - "Age Group Squad"
# - "Bronze"
# - "Distance"
# - "Gold"
# - "Intermediate Development"
# - "Junior Development"
# - "Junior Squad"
# - "Masters"
# - "National Squad"
# - "Silver"
# - "University"
# - "Winch-Centric"
# - "Young Advanced"
# - "Youth Squad"
# - "Employees"
# - "Lessons Helper"
# - "Level 1 Swim Teacher"
# - "Level 2 Swim Teacher"
# - "Lifeguards"
# - "Officials"
type: "swimmer"
#type: "volunteer"
#type: "committee"
#type: "coach"
#############################################
# Entity Types
#############################################
types:
volunteer:
ignore_coach: True # If coach, do not need to be a volunteer
ignore_committee: True # If committee, do not need to be a volunteer
groups:
- "Officials"
committee:
jobtitle: True # must have a job title
swimmer:
name: "Squad swimmers"
check_se_number: true
#non-competitive:
# name: "Learn to Swim swimmers"
# check_se_number: False
# parents: True
jobtitle:
ignore:
- "CEO" # If CEO, don't need to be a committee member.
#############################################
# Issue handling
#
# Override the default message for an error.
# Set ignore: true to ignore the message
# See issue.py for a list of issues.
#############################################
issues:
E_CONFIRMATION_EXPIRED: # ignore confired errors during lockdown
ignore_error: true
E_NOT_CONFIRMED:
ignore_error: true
#############################################
# Swim England Correlations
#############################################
swim_england:
base_url: "https://www.swimmingresults.org/"
check_url: "https://www.swimmingresults.org/membershipcheck/member_details.php?myiref="
test_id: 516115
##################################################
# Selenium
# Used for Swim England and Facebook checking
##################################################
selenium:
browser: "Safari"
# web_driver: "C:\\Program Files (x86)\\Python37-32\\Scripts\\chromedriver.exe"
web_driver: "/usr/bin/safaridriver"
##################################################
# Records
# Used to configure swimming records
##################################################
records:
relay: false
age_eoy: true # Calculate age at EOY, not age from SCM export file (where possible)
verify: true # Check a club member at time of swim (where possible)
se_only: true
all_ages_u18: false
overall_fastest: false
# Debug level
# Set to 0 for no debug info
# A setting of 1 is recommended while getting it working!
debug_level: 1
With a few minor changes to the config, this file worked for me. Most of the changes were because elements do not exist in my SCM.
Can you try this config?
It will not be exactly what you need, but will determine if the error is config related.
I have been developing on Python 3.10, on Linux and Windows. I've updated my Linux to 3.11, and is still works. So think this rules out Python version issues.
What is confusing me is the original error message TypeError: unhashable type: 'list'
, as it should not be a list, it should be a dictionary. I have seen errors where the Mac version of Python handles data types differently. So it could be a Mac issue. Sorry, but I don't have a Mac to test on.
If this config does not work, I'll need to add a few debug statements in.
Which method did you use to install, pip3 install
or git clone
?
#############################################
# Configuration of SCM-Validator
# Darren WHitt
# May 2023
#
#############################################
# Your swimming club name.
club: "Winchester City Penguins Swimming Club"
allow_update: False # Set to true if this tool is allowed to edit SCM
# Set to false if you don't trust the software to be reliable.
#############################################
# Email config
#############################################
email:
smtp_server: smtp.server.net
smtp_port: 25
username: someone@somewhere.com
send_to: someone@gmail.com
tls: False
password: "email.enc"
#############################################
# File input, for correlation
#############################################
files:
"swim_england.csv":
check_se_number: true
mapping:
Firstname: 'First Name'
Lastname: 'Surname'
# KnownAs: 'Known As'
ASANumber: 'Member ID'
# Gender: 'Gender'
# ASACategory: 'Category'
DOB: 'Date of Birth'
dob_format: '%Y/%m/%d'
#############################################
# Configure Swimmer Checks
#############################################
swimmers:
username:
min_age: 17 # Min age to have a user name
parent:
mandatory: True
max_age: 17 # Age a parent is mandatory until
confirmation_difference:
verify: True # if there is > 3 month differnence in confirm date
# between parent and child, report an issue.
absence:
time: 182 # Warn if not seen at swimming for this period of time
#############################################
# Configure Parent Checks
#############################################
parents:
age:
min_age: 17 # min age to be a parent
child: 21 # Age at which child should not longer have a parent
login:
mandatory: True # must have a login to SCM
#############################################
# Configure Member Checks
#############################################
members:
confirmation:
expiry: 365
align_quarter: True # Align expiry to calender quarter
# So reminders go in batches.
dbs:
expiry: 60 # Days waring prior to expiry.
newstarter:
grace: 90 # Don't give errors for 90 days, giving admin time to sort it all out
inactive:
time: 365 # Warn if member in inactive state for this many days
#############################################
# Configure Coaches
#############################################
coaches:
role:
mandatory: True # All coaches, must be in a coach role
#############################################
# Configure Roles
#############################################
roles:
volunteer:
mandatory: True
login:
unused: 180 # Error if not used in 180 days
role:
"Head Coaches":
check_permissions: False
is_coach: True # Should have "Is A Coach" ticked.
"Coaches":
check_permissions: True
is_coach: True # Should have "Is A Coach" ticked.
#"Lessons Head Teacher":
# check_permissions: False
# is_coach: True # Should have "Is A Coach" ticked.
#"Lessons Level 1 Teacher":
# check_permissions: True
# is_coach: True # Should have "Is A Coach" ticked.
#"Lessons Level 2 Teacher":
# check_permissions: True
# is_coach: True # Should have "Is A Coach" ticked.
#"Squad Rep":
# check_permissions: True
#"Register Taker":
# check_restrictions: True # Check they have session restrictions
#############################################
# Configure Groups
#############################################
groups:
priority: # If a user is in multiple groups - these take priority (in this order)
- 'Masters'
group:
#'Membership Only':
# no_sessions: true
#
# Squads
'Development':
type: swimmer
# 'Age Group Squad':
# type: swimmer
# 'Bronze':
# type: swimmer
# 'Distance':
# type: swimmer
# 'Gold':
# type: swimmer
# 'Intermediate Development':
# type: swimmer
# 'Junior Development':
# type: swimmer
# 'Junior Squad':
# type: swimmer
# 'Masters':
# type: swimmer
# min_age: 18
# 'National Squad':
# type: swimmer
# 'Silver':
# type: swimmer
# 'University':
# type: swimmer
# 'Winch-Centric':
# type: swimmer
# 'Young Advanced':
# type: swimmer
# 'Youth Squad':
# type: swimmer
# # Learn to swim
# 'LTS Adult':
# type: swimmer
# max_sessions: 2
# sessions:
# - 'LTS'
# 'LTS Little Penguins':
# type: swimmer
# max_sessions: 2
# sessions:
# - 'LTS'
# 'LTS Stage 1':
# type: swimmer
# max_sessions: 2
# sessions:
# - 'LTS'
# 'LTS Stage 2':
# type: swimmer
# max_sessions: 2
# sessions:
# - 'LTS'
# 'LTS Stage 3':
# type: swimmer
# max_sessions: 2
# sessions:
# - 'LTS'
# 'LTS Stage 4':
# type: swimmer
# max_sessions: 2
# sessions:
# - 'LTS'
# 'LTS Stage 5':
# type: swimmer
# max_sessions: 2
# sessions:
# - 'LTS'
# 'LTS Stage 6':
# type: swimmer
# max_sessions: 2
# sessions:
# - 'LTS'
# 'LTS Stage 7':
# type: swimmer
# max_sessions: 2
# sessions:
# - 'LTS'
# 'LTS Stage 8':
# type: swimmer
# max_sessions: 2
# sessions:
# - 'LTS'
# 'LTS Stage 9':
# type: swimmer
# max_sessions: 2
# sessions:
# - 'LTS'
# 'LTS Stage 10':
# type: swimmer
# max_sessions: 2
# sessions:
# - 'LTS'
# # Teachers and lessons helpers
# "Level 1 Swim Teacher":
# check_dbs: true
# min_age: 16
# # login: true
# 'Level 2 Swim Teacher':
# check_dbs: True
# min_age: 16
# # login: true
# 'Lessons Helper':
# min_age: 14
# # Other
# 'Lifeguards':
# check_dbs: true
# min_age: 16
# 'Officials':
# type: volunteer
# unique: False
#'Team Manager':
# check_dbs: true
# type: volunteer
# unique: False
#'Duty Parent':
# check_dbs: True
# type: volunteer
# unqiue: false
#############################################
# Configure Sessions
#
# Sessions not listed will not be checked
#############################################
sessions:
absence: 120 # Number of days allowed to miss a sesssion
register: 60 # Alert if register not taken for this many days
session:
'Club Session':
groups:
- 'Development'
#############################################
# Codes of Conduct
#############################################
#conduct:
#"WCPSC Code of Conduct for Coaches and Teachers":
# types:
# - "coach"
#"WCPSC Code of Conduct for Trustees, Officials and Volunteers":
# types:
# - "volunteer"
# - "committee"
#"WCPSC Code of Conduct for Parents / Guardians":
# types:
# - "parent"
#"WCPSC Code of Conduct for Swimmers":
# types:
# - "swimmer"
# ignore_group:
# - "LTS Little Penguins"
#"Data Protection":
# types:
# - "coach"
#############################################
# Facebook Correlations
#############################################
#facebook:
# files:
# - "Nottingham Leander Swimmers.html"
# - "Nottingham Leander Masters.html"
# - "Nottingham Leander Water Polo.html"
#groups:
# - https://www.facebook.com/groups/wcpsc.admin/
#############################################
# Lists
#
# Configure the criteria for auto-generated lists
#
#############################################
lists:
suffix: " (Generated)" # Use to identity generated lists
edit: True # Allow script to modify generated lists
confirmation: True # Generate lists of non-confirmed and expired confirmation members
#conduct:
#- "WCPSC Code of Conduct for Coaches and Teachers"
#- "WCPSC Code of Conduct for Parents / Guardians"
#- "WCPSC Code of Conduct for Swimmers"
#- "WCPSC Code of Conduct for Trustees, Officials and Volunteers"
list:
"Club wide distribution":
#group:
#- "Advanced Development"
# - "Age Group Squad"
# - "Bronze"
# - "Distance"
# - "Gold"
# - "Intermediate Development"
# - "Junior Development"
# - "Junior Squad"
# - "Masters"
# - "National Squad"
# - "Silver"
# - "University"
# - "Winch-Centric"
# - "Young Advanced"
# - "Youth Squad"
# - "Employees"
# - "Lessons Helper"
# - "Level 1 Swim Teacher"
# - "Level 2 Swim Teacher"
# - "Lifeguards"
# - "Officials"
type: "swimmer"
#type: "volunteer"
#type: "committee"
#type: "coach"
#############################################
# Entity Types
#############################################
types:
volunteer:
ignore_coach: True # If coach, do not need to be a volunteer
ignore_committee: True # If committee, do not need to be a volunteer
#groups:
# - "Officials"
committee:
jobtitle: True # must have a job title
swimmer:
name: "Squad swimmers"
check_se_number: true
#non-competitive:
# name: "Learn to Swim swimmers"
# check_se_number: False
# parents: True
jobtitle:
ignore:
- "CEO" # If CEO, don't need to be a committee member.
#############################################
# Issue handling
#
# Override the default message for an error.
# Set ignore: true to ignore the message
# See issue.py for a list of issues.
#############################################
issues:
E_CONFIRMATION_EXPIRED: # ignore confired errors during lockdown
ignore_error: true
E_NOT_CONFIRMED:
ignore_error: true
#############################################
# Swim England Correlations
#############################################
swim_england:
base_url: "https://www.swimmingresults.org/"
check_url: "https://www.swimmingresults.org/membershipcheck/member_details.php?myiref="
test_id: 516115
##################################################
# Selenium
# Used for Swim England and Facebook checking
##################################################
selenium:
browser: "Safari"
# web_driver: "C:\\Program Files (x86)\\Python37-32\\Scripts\\chromedriver.exe"
web_driver: "/usr/bin/safaridriver"
##################################################
# Records
# Used to configure swimming records
##################################################
records:
relay: false
age_eoy: true # Calculate age at EOY, not age from SCM export file (where possible)
verify: true # Check a club member at time of swim (where possible)
se_only: true
all_ages_u18: false
overall_fastest: false
# Debug level
# Set to 0 for no debug info
# A setting of 1 is recommended while getting it working!
debug_level: 1
Hi Colin, many thanks for your help. All working well, I think it was down to some basic yaml formatting - things not aligned properly. May I make two additional feature suggestions?
First, for auto-generated lists, it would be great if more than group could be specified: I would like to create an email list "Club wide distribution" which includes all the groups that the list should include. Likewise, it would be helpful if more than one type could be specified of who in the groups the list applies to.
Second, in the entity types, would it be possible to support non-competitive? eg.
non-competitive:
name: "Learn to Swim swimmers"
check_se_number: False
parents: True
I realise this is dependent on the API supporting this. Thanks for your consideration.
Great to hear the original issue has been resolved by config.
There must be something different in how Python on Macs deals with errors. Not sure if I can improve the error handling without access to a Mac!
The two feature requests, I have created as separate entries. https://github.com/ColinRobbins/scm-helper/issues/54 and https://github.com/ColinRobbins/scm-helper/issues/55 respectively.
Not sure how soon I'll get to them, this is usually a project I deal with in the dark winter evenings.
Hi, this is the output I get when trying to run SCM Helper:
Please let me know if you need any further information. Many thanks, Darren.