bugy / script-server

Web UI for your scripts with execution management
Other
1.52k stars 244 forks source link

Struggling to configure output files to be downloadable #626

Closed dragonborn117 closed 1 year ago

dragonborn117 commented 1 year ago

Hi,

I'm struggling to configure script-server to be able to download the files. Looking at the logs it seems to try and read the file path per character rather than as a string.

line in Python code being run that outputs file: df.to_excel("/home/d/script-server/file_outputs/"+output_filename,index=False)

script-server logs: 2023-02-15 13:54:27,904 [script_server.file_download_feature.INFO] Created download folder for 127.0.0.1: temp/resultFiles/36065c22f51e/1676469267904 2023-02-15 13:54:27,904 [tornado.access.INFO] 200 POST /executions/start (127.0.0.1) 22.08ms 2023-02-15 13:54:28,007 [tornado.access.INFO] 101 GET /executions/io/10 (127.0.0.1) 0.71ms 2023-02-15 13:54:32,179 [script_server.file_download_feature.WARNING] file / is a directory. Not allowed 2023-02-15 13:54:32,179 [script_server.file_download_feature.WARNING] file h (full path = h) not found 2023-02-15 13:54:32,179 [script_server.file_download_feature.WARNING] file o (full path = o) not found 2023-02-15 13:54:32,180 [script_server.file_download_feature.WARNING] file m (full path = m) not found 2023-02-15 13:54:32,180 [script_server.file_download_feature.WARNING] file e (full path = e) not found 2023-02-15 13:54:32,180 [script_server.file_download_feature.WARNING] file / is a directory. Not allowed 2023-02-15 13:54:32,180 [script_server.file_download_feature.WARNING] file d (full path = d) not found ... 2023-02-15 13:54:32,187 [script_server.file_download_feature.WARNING] file . is a directory. Not allowed 2023-02-15 13:54:32,187 [script_server.file_download_feature.WARNING] file x (full path = x) not found 2023-02-15 13:54:32,187 [script_server.file_download_feature.WARNING] file l (full path = l) not found 2023-02-15 13:54:32,187 [script_server.file_download_feature.WARNING] file s (full path = s) not found 2023-02-15 13:54:32,187 [script_server.file_download_feature.WARNING] file x (full path = x) not found

Line from the conf/runners/.json file: "output_files": "/home/d/script-server/file_outputs/test2.xlsx",

Is there something I am missing?

Thanks

bugy commented 1 year ago

Hi @dragonborn117, output files should be an array, not a single string, i.e.

"output_files": [
  "/home/d/script-server/file_outputs/test2.xlsx"
]
dragonborn117 commented 1 year ago

Thanks @bugy for the quick reply, this has fixed the issue. One of my parameters enables the user to choose the name of the file that is downloadable. How would allowing this look in the /conf/runners/.json file? Currently, as above, I configured it to read test2.xlsx and set the output file parameter to test2.

bugy commented 1 year ago

use ${parameter name} syntax

dragonborn117 commented 1 year ago

Got it working! You have been very helpful, thank you for creating such a good tool :)

bugy commented 1 year ago

Glad it helped :)