Closed miaeyg closed 1 year ago
I think I know what happened... It looks like the "create_file" method does not accept "/". When I changed to "Public" instead of "/Public" it worked. Not user-friendly in my opinion.
Agreed, not user friendly! Appreciate the feedback - we will get this fixed.
Hi @jlwalke2
Is there a way to use the "create_file" method to create a file in a specified path for example I want to create a file in the path "/Public/Demo". This does not seem to work as well.
Thanks
Noticed that "get_folder" exhibits the same behavior - does not accept "/" in the folder name. Also noticed that I get a warning if there is more than one folder with the same name - for example searching for "Public" results in two folders being returned and "sasctl" picks randomly one of them. How can I do a "get_folder" on a specific path like "/Public" and not get back something like "/Model Repositories/Public"? This is very troubling as I have no control over what I am searching for with the "get_folder" method
Yes, excellent point - the existing folders.get_folder()
functionality is ambiguous whenever there is more than one folder with the same name (it returns the first match it finds and just warns that there were others). You're also correct that the issue is really with folders.get_folder()
- files.create_file()
just calls it behind the scenes to find the desired folder.
I've updated get_folder()
(commit 41b1d8b) to use an alternative endpoint (https://developer.sas.com/apis/rest/CoreServices/#get-a-folder-with-a-path-or-a-child-uri) whenever a folder path is specified.
You should now be able to do something like files.create_file("example.txt", "/Public/Demo")
. You can install the latest from source, or we will include this update in the next release.
Please feel free to re-open this issue if you still encounter issues.
Hi all,
I am trying to upload a file to the /Public folder in Viya 2022.12 and the Files.create_file method consistently fails with the error in line 76 of "files.py":
ValueError: Folder '/Public' could not be found
I cannot find any explanation to this error. The /Public exists. Permissions were not modified for this folder. Any idea?
Eyal