Problem and solution: Prusaslicer - send gcode file with spaces using the curl script

Hi, using Repetier server and firmware for a long time and used to send the gcode file via postprocessing script to my 3D Printer.
The script uses curl like recommended here in this forum and repetier descriptions.

A few months ago I switched from simplify3D to Prusaslicer.
Since then I'm having problems sending the gcode file if the gcode file path contains spaces.
In this case the script throws an error and is stopped.

Now I found the reason and also the solution, which I like to share:

Why does this happen?
- My Postprocessing command in prusaslicer settings:
- the batchfile contains the curl command.  
- the prusaslicer adds the gcode path as an argument to my postprocessing command.
    - If the gcode-path contains no spaces, the argument is for example d:\3D_projects\gcodes\testcube.gcode
      In this case everything works fine.
    - If the gcode-path contains spaces, the argument is for example "d:\3D projects\gcodes\testcube V2.gcode" (including quotes)
- the curl command which I used, contains  c:\Windows\System32\curl.exe ..... -F "filename=@%1"
    If %1 is replaced with the appended path including quotes, the result is a full command like:
       c:\Windows\System32\curl.exe ..... -F "filename=@d:\3D projects\testcube V2.gcode"
    which produce kind of nested quotes, which are not allowed in a script and causes the described error.

My solution:
modify the curl command to (watch the ~):
   c:\Windows\System32\curl.exe ..... -F "filename=@%~1"
Then the quotes of the gcode path are removed and the script also works with gcode paths with spaces in it.
As for now I found no negative aspects.

Maybe this helps others, too.

Sign In or Register to comment.