You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
I'm facing issues with performing file uploads to the model_upload directory for an PaoC instance under the utilization of tm1.files.update_or_create function.
Although I'm able to upload a file to the super ordinate data directory, I cannot upload the same file to the subordinate model_upload directory.
Reproduction
I ran the following code snippet from my local machine.
The excluded TargetPath variables are exemplary for the different attempts i took to perform the file-upload to the model_upload directory instead of the data directory. (I have also tried various other combinations e.g.: "\", string concatenation etc.).
filename = "filexyz.csv"
SourcePath = filename
TargetPath = filename
#TargetPath = f"model_upload/{filename}"
#TargetPath = f"D:/prod/tm1/Data/model_upload/{filename}"
# Connect to the TM1 instance
with TM1Service(
base_url='',
user="",
namespace="",
password="",
ssl=True,
verify=True,
async_requests_mode=True) as tm1:
with open(SourcePath, "rb") as file:
tm1.files.update_or_create(file_name=TargetPath, file_content=file.read())
While there is no prefix to reference the desired target directory (as shown in current TargetPath variable above) the upload is performed directly in the data directory.
When I execute the code and reference an explicit directory (e.g. commented out TargetPath variables above) I get the following error message and the upload is not executed.
Something else went wrong. Check error code: Text: '{"error":{"code":"278","message":"Only Document entries may be created in the Contents('Blobs')/Contents collection."}}' - Status Code: 400 - Reason: 'Bad Request' - Headers: {'Content-Length': '124', 'Connection': 'keep-alive', 'Content-Encoding': 'gzip', 'Cache-Control': 'no-cache', 'Content-Type': 'application/json; charset=utf-8', 'OData-Version': '4.0'}
Expectation
My expectation would be that the file upload for a specific directory (e.g. model_upload) would work in the same way as for an unspecified directory (data).
Version
Python 3.11.4
TM1py 2.0.3
TM1 Server Version 11.8.02200.2
PAW Version 2.0.96
Any ideas what I am doing wrong, or what could be the reason?
The text was updated successfully, but these errors were encountered:
Hi,
Description
I'm facing issues with performing file uploads to the model_upload directory for an PaoC instance under the utilization of tm1.files.update_or_create function.
Although I'm able to upload a file to the super ordinate data directory, I cannot upload the same file to the subordinate model_upload directory.
Reproduction
I ran the following code snippet from my local machine.
The excluded TargetPath variables are exemplary for the different attempts i took to perform the file-upload to the model_upload directory instead of the data directory. (I have also tried various other combinations e.g.: "\", string concatenation etc.).
While there is no prefix to reference the desired target directory (as shown in current TargetPath variable above) the upload is performed directly in the data directory.
When I execute the code and reference an explicit directory (e.g. commented out TargetPath variables above) I get the following error message and the upload is not executed.
Something else went wrong. Check error code: Text: '{"error":{"code":"278","message":"Only Document entries may be created in the Contents('Blobs')/Contents collection."}}' - Status Code: 400 - Reason: 'Bad Request' - Headers: {'Content-Length': '124', 'Connection': 'keep-alive', 'Content-Encoding': 'gzip', 'Cache-Control': 'no-cache', 'Content-Type': 'application/json; charset=utf-8', 'OData-Version': '4.0'}
Expectation
My expectation would be that the file upload for a specific directory (e.g. model_upload) would work in the same way as for an unspecified directory (data).
Version
Python 3.11.4
TM1py 2.0.3
TM1 Server Version 11.8.02200.2
PAW Version 2.0.96
Any ideas what I am doing wrong, or what could be the reason?
The text was updated successfully, but these errors were encountered: