- ReadTextFile cannot read the file
- This model does not have read access to the specified folder.
- If you are running this model in Analytica Cloud Player (ACP), this probably means that you have attempted to read a file outside of your own project directory.
This error occurs when your model uses a built-in file system function such as ReadTextFile, WriteTextFile, ReadBinaryFile, etc., to read a file in a folder that does not allow the required read or write access.
You are most likely to encounter this error when running a model in ACP that uses one of these file system functions. On the ACP server, you are only allowed to access files in your own project folder. This error appears hen your model tries to read or write a file that is outside of your own Project folder.
When you were developing the model on your own computer, you may have embedded an absolute file name into your model, or even a relative file name that starts with
"..\" (which means parent folder). In this case, even though the model finds your file when run on your own computer, after you upload it to ACP, the desired path would be outside of your own account & project.
How to fix
You need to modify the call to the file function (like to ReadTextFile) so that the file path does not refer to an arbitrary folder on your computer. In most cases, you'll want to remove any file path from the filename, and leave only the file name. For example, instead of
"..\..\..\downloads\data.csv", you should specify the filename as only
"data.csv", and then upload your data file to the same project folder as your model on ACP.
Where are the permissions
As a end-user of ACP, the permissions that deny this access are not within your control. Basically, you aren't allowed to access data in other accounts.
If you believe you should not be seeing this error, and are a system administrator or developer who is debugging this problem, then you'll need to understand where the permissions are being specified.
The permissions in this case are NOT determined by the operating system's file system's permissions. Instead, your model had been launched (opened) at some earlier point via a call to OpenModelFile. In ACP, this appears in the
"Suan account.ana" model (which implements the ACP user portal). The call to OpenModelFile specified the permissions using the (hidden) parameters «folder» and «permission». It is the parameters specified in that call that has restricted access.