Page 1 of 1
Additional Terminal Commands Debugging
Posted: Wed Jan 04, 2023 9:57 am
by ctilley79
I'm having trouble calling a Python script from the post processing section in V5. I believe it has to do with the way file paths are generated when I call the command. Is there any way to view debugging info for commands sent to the terminal? I want to see exactly what command was sent to the terminal and any errors that resulted. I'm on macOS. Is there any system log that would have a record when S3D processes this script?
Here's how I call the script.
Code: Select all
python3 "/Users/uname/Development/S3D/up.py" "[output_dir]/[output_filename].gcode"
Everything to the right of up.py is a sysArg
Re: Additional Terminal Commands Debugging
Posted: Thu Jan 05, 2023 6:16 am
by S3D-Jason
You might want to try putting the full path to python3 at the start. Type "whereis python3" in a Terminal window and then use that path at the start of the command.
Re: Additional Terminal Commands Debugging
Posted: Thu Jan 05, 2023 9:52 pm
by ctilley79
S3D-Jason wrote: ↑Thu Jan 05, 2023 6:16 am
You might want to try putting the full path to python3 at the start. Type "whereis python3" in a Terminal window and then use that path at the start of the command.
Already tried that and a dozen different ways. It would be nice if there was an operating system tool I could use to see what SImplify3D is sending to the terminal. It would also be nice if you could write a blog post on the ins and outs of the post processing (additional terminal commands) feature.
Re: Additional Terminal Commands Debugging
Posted: Tue Jan 10, 2023 8:59 am
by S3D-Jason
I just ran a test on my Mac, so I can give you the exact instructions I used.
First, open a Terminal window and type "whereis python3". Mine says it is located at "/usr/bin/python3". We will use that same path below.
Next, create a simple python script for testing. I called mine "script.py" and placed it in the Downloads folder. The contents of the script are below.
file = open('/Users/YOURUSERNAMEHERE/Downloads/test.txt', 'w')
file.write("hello")
file.close()
Save the script, the open S3D, go to Edit Process Settings > Scripts > Post Processing. Add the following line:
/usr/bin/python3 /Users/YOURUSERNAMEHERE/Downloads/script.py
Save your settings. Now click Prepare to Print, and then "Export Build File to Disk". The custom script will run when you export the file and you should see a new file in your Downloads folder called test.txt that says "hello".
I just tested all of these steps myself and it worked correctly.
Re: Additional Terminal Commands Debugging
Posted: Mon Jan 16, 2023 11:04 am
by jandrunas
I use linux and just wrap everything in a shell script and then put the full path to the script in the post processing screen
/usr/local/bin/send-to-printer "[output_filepath]"