ComfyUI_Comfyroll_CustomNodes icon indicating copy to clipboard operation
ComfyUI_Comfyroll_CustomNodes copied to clipboard

CR_SaveTextToFile. File delimiter incompatible with Linux

Open llnancy opened this issue 1 year ago • 3 comments

image

llnancy avatar Nov 03 '24 06:11 llnancy

comfyroll

Made the following changes highlighted in red boxes to support using this node in Linux OS's. Simple fix since module already imports the os module.

Don't forget to delete node's cached python import files for change to take effect. These files are in custom_nodes/ComfyUI_Comfyroll_CustomerNodes/pycache/ folder. Delete the cache files then restart Comfyui and node should work in Linux.

lvang77 avatar Nov 30 '24 08:11 lvang77

Also using "os.path.join()" is another way to fix this issue.

ShadowChenCSD avatar Dec 05 '24 02:12 ShadowChenCSD

Meh, should have looked at the issue list before the code ... and obviously this breaks on a Mac, too. May I suggest something like:

$ diff -Naurw nodes_utils_text.py.orig nodes_utils_text.py
--- nodes_utils_text.py.orig	2025-03-22 17:07:48
+++ nodes_utils_text.py	2025-03-22 17:26:30
@@ -162,7 +162,7 @@
     
         show_help =  "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/List-Nodes#cr-save-text-to-file" 
     
-        filepath = output_file_path + "\\" + file_name + "." + file_extension
+        filepath = os.path.join(output_file_path, file_name + os.extsep + file_extension)
  
         index = 1
 

charly4711 avatar Mar 22 '25 16:03 charly4711