FileField: Using File from FileResource

Hi!

I’m using the FileField (great feature!) and trying to get the FileResource into a File. However I can’t get this done. This is my code. What am I missing?

Regards,

Bart

def set_params(self, params, **kwargs):
path_file_1 = File.from_url(params.test2)
content1 = path_file_1.getvalue_binary()
s1=str(content1,‘utf-8’)
data1 = StringIO(s1)
df_flocs = pd.read_csv(data1, sep=";", index_col = 0)
serialized_df_flocs_csv = df_flocs.to_dict()

FileResource.file, so in your case params.test2.file

See Topics - Files | VIKTOR Documentation & SDK Reference - API (v1) | VIKTOR Documentation

2 Likes