Howdy y'all,
I have been working on a python script that translates gcode into a scripting language for a 6 axis robot. The script itself works perfectly from both inside the IDE and inside a command prompt. The script allows me to pass arguments to it in both of these places. Where I have been having trouble is from within the post processing section of Simplify3D. I have an arcwelding script right above this that works perfectly but the script I have written refuses to work.
For reference, I am on V5.1.2. I have tried repackaging the script as an executable, rewriting how the input arguments are handled, passing the full file path rather than just the file name, running the script alone (without the first script above it), and many more troubleshooting methods.
From what I have seen, it looks like the script is failing to open successfully. This is once again strange since I can run the script flawlessly from within the command prompt and IDE. I cannot even run a "Hello World" script that I have written. My best guess now is maybe the script needs to open a console to successfully run the code? I wouldn't know how to test for that so now I am just lost.
Can anyone help me on my troubleshooting journey? Any help would be very much appreciated. I have included the code snippet below that handles the argument input:
def gcode_input():
global file_name
file_obj = ""
try:
args = sys.argv
file_name = args[1]
file_obj = open(file_name + ".GCODE", 'r')
except:
file_name = input("Enter G-Code file name-->")
file_obj = open(file_name + ".GCODE", 'r')
raw_gcode = []
for line in file_obj:
raw_gcode.append(line)
file_obj.close()
return raw_gcode