Using synapser 0.1.28 and PythonEmbedInR 0.1.15 I try to get all child files of a folder with synGetChildren(includeTypes = "file"). Converting the result to a list with as.list() fails:
I get the same error with includeTypes = "folder", but no error if I use includeTypes = list("file", "folder") or if I leave out includeTypes altogether.
This is another conversion problem between R and Python. At a low level, we do not know if user meant to pass a single character or a list of one character.
Per , for this specific case, the Python client could allow user to either pass in a single value or a list of values to filter.
I will move this issue to Python to add a fix there. But this would be validated in both Python and synapser client.
This issue come up often. I would like to think more about this and look into PythonEmbedInR before making the change in the Python client. Otherwise, we would end up changing majority of functions in Python client to work with synapser.
, this problem occurs because when you type synGetChildren(includeTypes = "file"), your input is an R vector. When we converted to Python, a vector contains 1 value is converted to a single value.
synGetChildren(includeTypes = list("file")) should work here to solve the problem. I created to document this more widely.
Ok, I'm glad there is a solution, though it is really not idiomatic in R to use a list here.
For the documentation of synGetChildren() specifically, we currently show three different ways to call the function, only one of which is correct, so we should make sure to clarify that as well:
I totally agree. I will update the documentation to:
1. Clearly state what string values can be used here.
2. Document the case where user has to use list() for a single value input.
documentation looks good now, thanks!