carloea2 commented on code in PR #9240:
URL: https://github.com/apache/texera/pull/9240#discussion_r4592889532


##########
frontend/src/app/workspace/component/menu/menu.component.ts:
##########
@@ -803,12 +806,34 @@ export class MenuComponent implements OnInit, OnDestroy {
 
     try {
       await navigator.clipboard.writeText(this.pythonCodeForModal);
-      this.notificationService.success("Python script copied to clipboard");
+      // The copied script imports its helpers, so it does not run without the 
module.
+      this.notificationService.success(
+        this.pythonHelpersModuleForModal
+          ? "Python script copied to clipboard. It needs the texera_helpers.py 
in the zip download next to it."
+          : "Python script copied to clipboard"
+      );
     } catch (error) {
       this.notificationService.error("Failed to copy Python script");
     }
   }
 
+  /**
+   * The script as a zip, with the `texera_helpers.py` it imports beside it: 
Python finds a
+   * module in the script's own directory, so the unzipped folder runs with 
nothing installed.
+   */
+  public async downloadPythonZip(): Promise<void> {
+    if (!this.pythonCodeForModal) {
+      return;
+    }
+    const zip = new JSZip();
+    zip.file("script.py", this.pythonCodeForModal);

Review Comment:
   A File Scan input named `texera_helpers.py` reads correctly in Texera, but 
the zip overwrites it with the helper module. My one-line input becomes 615 
rows. `script.py` collides too. Please reserve both archive filenames when 
assigning source names.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to