0

I am trying to send g-code commands to my Ultimaker S3. I can do this through SSH, where a python program is automatically opened and is ready to take commands. Here is a picture example, I am able to run this line and my printer zeroes its axes: sendgcode G28

Ultimaker SSH + sendgcode image

I want to make a local python program on my system to send lines of gcode commands (via SSH to the Ultimaker) and run other processes on my computer.

When I try Paramiko, it adds a "-c" flag when I try to send "sendgcode G28". ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command("sendgcode G28")

I get this error from the Ultimaker program within SSH:

ssh.load_system_host_keys() 

ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())

ssh.connect(router_ip, 
                        username=router_username, 
                        password=router_password,
                        look_for_keys=False )

ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command("sendgcode G28")

output = ssh_stdout.read().decode()

print(output)

*** Unknown syntax: -c sendgcode G28

It is adding that "-c" and giving an error within the SSH program.

How can I resolve this? Is there a library that would work better than Paramiko?

AD1617
  • 1
  • you can try Fabric instead of bare Paramiko: http://www.fabfile.org – voy Sep 06 '21 at 22:01
  • Thanks for the link, Martin! invoke_shell() is what I needed. https://stackoverflow.com/questions/54703355/ssh-using-python-script – AD1617 Sep 07 '21 at 08:07

0 Answers0