To be honest, I’m not sure why this one went wrong and others did not. I can tell you what’s up, for what it’s worth. The function below checks for parameters whether they refer to directories and does some processing. It only works with strings, but the 2.0 got received as number instead. Converting it from a number to a string before converting solves it.
It can be a challenge to trace this back to its source, though I can say it’s probably not in the code you posted, but somewhere in a component property.
My fix
def getPaths(filePath):
"""Helper to return absolute and relative paths (or None)
:param filePath: str to a potential file path (rel or abs)
:return: dict of 'asb' and 'rel' paths or None
"""
thisFile = {}
# NB: Pathlib might be neater here but need to be careful
# e.g. on mac:
# Path('C:/test/test.xlsx').is_absolute() returns False
# Path('/folder/file.xlsx').relative_to('/Applications') gives error
# but os.path.relpath('/folder/file.xlsx', '/Applications') correctly uses ../
filePathStr = str(filePath);
if len(filePathStr) > 2 and (filePathStr[0] == "/" or filePathStr[1] == ":")\
and os.path.isfile(filePathStr):
thisFile['abs'] = filePathStr
thisFile['rel'] = os.path.relpath(filePathStr, srcRoot)
return thisFile
else:
thisFile['rel'] = filePathStr
thisFile['abs'] = os.path.normpath(join(srcRoot, filePathStr))
if os.path.isfile(thisFile['abs']):
return thisFile