Post-processing script not running
My Linux version of PS v2.2.0 doesn't seem to run any post-processing script I insert.
- the script exists
- I am using the full pathname to the script
- I can run the script on the command line without an issue, using the full pathname
However, PS doesn't seem to be attempting to run it at all. I inserted some temp "write to file" to test, and nothing.
I purposely broke the filename, just to try to get an error. Nothing.
It's like it doesn't attempt to do anything at all with this textbox.
Best Answer by Area51:
Wait a minute... How do you "run" a post processing script?
I am assuming it runs immediately after you "Slice" a model. Press the button slice, let it slicer, and the post processing script is ran immediately after it slices.
The script is run just before the g-code is saved (export, upload), not after the slice operation.
RE: Post-processing script not running
Can you post the script?
--------------------
Chuck H
3D Printer Review Blog
RE: Post-processing script not running
Can you post the script?
Sure. Though, it's not the script that doesn't work. I'm suspecting it's that isn't even called nor executed on Linux?
$ cat post-processing-test.bash
#~/bin/bash # source code shows a lot of VARs written, let's find out
env > ~/prusaslicer-post-processing.env
echo $1
Nothing is ever written. I also tried "breaking" the script on purpose, to see if there was an error message or something. Nope.
So that tells me one of two things. Either:
- A: The script is failing above, and the purposely broken script fails as well. Just there is no error capturing to debug either set of errors.
- or B: PrusaSlicer is not executing any scripts specified.
I am specifying the full path as the comments said to.
$ ls -l /home/eric/post-processing-test.bash
-rwxr-xr-x 1 eric eric 63 Sep 22 17:21 /home/eric/post-processing-test.bash
So without logs, I am unable to debug if there's a problem running the scripts, or if it is trying to run the scripts at all.
RE: Post-processing script not running
I have been using post scripts in PS on Linux Mint 19 and it worked.
The script you show is different from what I would use:
But I only recently switched back to Linux after a 20 year pause... 🤔
Have a look at my models on Printables.com 😉
RE: Post-processing script not running
I'm using python scripts on W7.
PS 2.2.0:
"C:\Program Files\Python38\python.exe" "C:\Users\7800mbz\AppData\Local\Programs\Python\Python37-32\Scripts\PrusaSlicer\mmuGcodeParser.py";
works without any problems.
Statt zu klagen, dass wir nicht alles haben, was wir wollen, sollten wir lieber dankbar sein, dass wir nicht alles bekommen, was wir verdienen.
RE: Post-processing script not running
Just found a PS post script, I made in Python to substitute G1 moves with G0 moves, when there is no extrusion:
This runs on Linux Mint 19 and needs Python 3 to be installed - the code is not optimized, but only a sample of a post script, so use at your own risk...
Just specify full path with script name in PrusaSlicer post-script dialog.
Have a look at my models on Printables.com 😉
RE: Post-processing script not running
#~/bin/bash
Change this to #!/bin/bash or #!/bin/sh
The "crash bang" sequence is needed to identify the interpreter to be used to execute the script.
So without logs, I am unable to debug if there's a problem running the scripts, or if it is trying to run the scripts at all.
Try running the script from your shell to debug. IIRC, it is called with the file name of the slicer gcode as the sole parameter.
and miscellaneous other tech projects
He is intelligent, but not experienced. His pattern indicates two dimensional thinking. -- Spock in Star Trek: The Wrath of Khan
RE: Post-processing script not running
$ cat post-processing-test.bash
#~/bin/bash # source code shows a lot of VARs written, let's find out
env > ~/prusaslicer-post-processing.env
echo $1
Avoid using ~ in scripts, depending of context this can be undefined or resolved to unexpected paths. For simple scripts use absolute paths or prefix with $HOME, $USER, etc.
Did you get a post-script to work?
Have a look at my models on Printables.com 😉
RE: Post-processing script not running
Will address everyones replies below in a forums-hack way to make multi-quote working here. 😉
I have been using post scripts in PS on Linux Mint 19 and it worked.
The script you show is different from what I would use:
#! /bin/bash# source code shows a lot of VARs written, let's find outenv > /home/eric/prusaslicer-post-processing.env# First parameter to script:echo $1 > /home/eric/prusaslicer-post-processing.txtBut I only recently switched back to Linux after a 20 year pause... 🤔
First off, and for several other replies below, yes, I do use #!/bin/bash. It was a typo in my post as I was hand typing the script.
I always execute the scripts on the command line first, so they work. 😉 Sorry!
I tried changing the home directory to absolute path, and it still does not output anything.
And the last echo command was there just there to see what PrusaSlicer would do with script output: would it display it in some log somewhere? And so on. It was just a test.
But sadly, using absolutely paths for each does not work.
I'm using python scripts on W7.
PS 2.2.0:
(snip screenshot)
"C:\Program Files\Python38\python.exe" "C:\Users\7800mbz\AppData\Local\Programs\Python\Python37-32\Scripts\PrusaSlicer\mmuGcodeParser.py";
works without any problems.
Thanks, but we are talking about Linux.
Just found a PS post script, I made in Python to substitute G1 moves with G0 moves, when there is no extrusion:
#!/usr/bin/python3
(snip script)
# End of scriptThis runs on Linux Mint 19 and needs Python 3 to be installed - the code is not optimized, but only a sample of a post script, so use at your own risk...
Just specify full path with script name in PrusaSlicer post-script dialog.
Yep, I know python fairly well. Whipped up a quick and dirty script, but no go!
$ cat /home/eric/prusaslicer-post-processing.python
#!/usr/bin/python3
fh = open('/home/eric/prusaslicer-post-processing.python.txt', 'w')
fh.write('test test\n')
fh.close()
Executing this on the command line works fine, using the absolutely path /home/eric/prusaslicer-post-processing.python.
Sadly, the slicer still does not execute this python script either!
And yes, it is set to +x - else I wouldn't be able to call the script from the commandline. And finally, I did try to call the python interrupter and pass it in as a final attempt - no go. 🙁
#~/bin/bash
Change this to #!/bin/bash or #!/bin/sh
The "crash bang" sequence is needed to identify the interpreter to be used to execute the script.
So without logs, I am unable to debug if there's a problem running the scripts, or if it is trying to run the scripts at all.
Try running the script from your shell to debug. IIRC, it is called with the file name of the slicer gcode as the sole parameter.
Yep, as mentioned earlier it was a typo in my post. It is #!/bin/bash, and runs fine outside of the slicer.
I do run all scripts on the command line. 😉
Right now, I want to know all of the ENVs passed because that's the #1 problem I have with the slicer - none of the "totals" are available in GCODE, nor do I have control over inserting proprietary firmware start gcode with PrusaSlicer - the values are supposed to be passed into this script, and the documentation says it uses environment vars. So I'm trying to get that list in a quick script, before I write up a real one.
$ cat post-processing-test.bash
#~/bin/bash # source code shows a lot of VARs written, let's find out
env > ~/prusaslicer-post-processing.env
echo $1Avoid using ~ in scripts, depending of context this can be undefined or resolved to unexpected paths. For simple scripts use absolute paths or prefix with $HOME, $USER, etc.
Did you get a post-script to work?
Good point. However, as mentioned above, absolute paths are not working either.
RE: Post-processing script not running
If it matters, I am using the appimage version. Just tried pulling latest, which seems to be the same version. Not sure on the git revision was the same.
RE: Post-processing script not running
FWIW - I used to run this monstrosity to extract metadata that wasn't available within Slic3rPE/PrusaSlicer at the time. I do just enough python to get familiar with it, then don't use it again for months or years, so the code is garbage. It does, however, work as a post-processing script on MacOS provided you can suck the entire gcode file into memory. If you're good with python, doing line-by-line parsing should be straightforward.
and miscellaneous other tech projects
He is intelligent, but not experienced. His pattern indicates two dimensional thinking. -- Spock in Star Trek: The Wrath of Khan
RE: Post-processing script not running
Thanks all. It's not an issue with the scripts. I can run the bash and python scripts manually in the terminal, using full paths.
I believe it's an issue with my AppImage version of PrusaSlicer on Ubuntu 20.04 that can't seem to run any script specified in the Post processing section. Full paths, etc.
I even moved the script to root, with world permissions (777), owned my eric:eric, and it still won't run. PrusaSlicer gives no indication of an error or parsing or anything, as I mis-type the name and break the scripts on purpose to try to generate an error.
Isn't there some type of log or debug output mode that would give a clue on Linux?
For anyone on Linux with a working script:
1. Can you "break" the script, and try to slice something? See if it gives you an error for a broken script?
2. Can you rename the post script to something else, so that PS errors that it can't find the script?
If you DO get some type of error feedback that will go a long way to tell us that PS isn't even attempting to run something on my system.
RE: Post-processing script not running
Just tried to run the script:
#! /bin/bash
# source code shows a lot of VARs written, let's find out
env > /home/eric/prusaslicer-post-processing.env
# First parameter to script:
echo $1 > /home/eric/prusaslicer-post-processing.txt
In PrusaSlicer 2.2.0 and 2.3.0 alpha in AppImage and on Linux Mint 19.3 and it worked fine. If path to script is misspelled or wrong, PS shows an error GUI dialog. The same is true if the script is missing execute permissions.
Both files is created in my home directory and contains the expected dumps.
Everything seems to work as expected. The difference I see, is that you are on the new Ubuntu 20.04, but Linux Mint is based on Ubuntu so the differences should be minimal.
Have a look at my models on Printables.com 😉
RE: Post-processing script not running
If path to script is misspelled or wrong, PS shows an error GUI dialog. The same is true if the script is missing execute permissions.
Well that pretty much settles it. PS is not even attempting to run it, as I do not get any errors or notifications at all.
Wait a minute... How do you "run" a post processing script?
I am assuming it runs immediately after you "Slice" a model. Press the button slice, let it slicer, and the post processing script is ran immediately after it slices.
I've even tried to "Export" gcode, as well as as save to sdcard. I never get a prompt of anything broken.
Am I doing it wrong?
RE: Post-processing script not running
Wait a minute... How do you "run" a post processing script?
I am assuming it runs immediately after you "Slice" a model. Press the button slice, let it slicer, and the post processing script is ran immediately after it slices.
The script is run just before the g-code is saved (export, upload), not after the slice operation.
Have a look at my models on Printables.com 😉
RE: Post-processing script not running
Wait a minute... How do you "run" a post processing script?
I am assuming it runs immediately after you "Slice" a model. Press the button slice, let it slicer, and the post processing script is ran immediately after it slices.
The script is run just before the g-code is saved (export, upload), not after the slice operation.
Thank you everyone. I thought I had tried "Export" and "Save to SD" several times. But that must have been inbetween tests and actual prints I was doing.
Sorry for the alarm... Maybe all this info can help someone in the future.
TL/DR: It works now, when pressing Export. 😯
RE: Post-processing script not running
The main thing is that it works now 🙂
And yes, it is not clear when the post script is run...
Have a look at my models on Printables.com 😉