<p>If the one in your question is your <em>complete</em> code, a possibility is that your computer is just buffering the output for the serial port, withholding it in memory.  Try to add</p>

<pre><code>ser.flush()
</code></pre>

<p>after your last line.  This command will... well... <em>flush</em> anything into the buffer through the actual connection.</p>

CC BY-SA 3.0
2018-01-24T23:09:26.587Z
2018-01-24T23:09:26.587Z
mac
<p>Sorry for the late answer, but with Repetrel v3 and later, we have the option for you to configure a secondary COM port, and relay G- or M-Code commands from your other source through the Repetrel software to the printer. Please contact us for assistance.</p>

<p>Note: I work for Hyrel 3D.</p>

CC BY-SA 4.0
2020-06-09T15:15:18.943Z
2020-06-09T15:15:18.943Z
Davo
<p>I am using python 3.6 with pySerial library to connect to the Hyrel System 30M 3D Printer. I am able to read the data from the device but unable to write any commands to it</p>

<p>Here is the code:</p>



<pre><code>    ser = serial.Serial()
    ser.port = 'COM4'
    ser.baudrate = 38400
    out = ser.readline()
    ser.write(b'M106 T14 S30\n') %This is the command to turn on the fan at 30% power
</code></pre>

<p>Can somebody suggest me how to write commands to printer through python</p>

<g-code><usb><serial-connection><python>
Sending G-code commands to Hyrel System 30M using python
Varun Kumthekar
# Sending G-code commands to Hyrel System 30M using python

(Asked by: username_0 on 2018-01-24)

I am using python 3.6 with pySerial library to connect to the Hyrel System 30M 3D Printer. I am able to read the data from the device but unable to write any commands to it
Here is the code:
    ser = serial.Serial()
    ser.port = 'COM4'
    ser.baudrate = 38400
    out = ser.readline()
    ser.write(b'M106 T14 S30\n') %This is the command to turn on the fan at 30% power

Can somebody suggest me how to write commands to printer through python

**Tags:** g-code, usb, serial-connection, python

---

## 2 answers

### Answer by username_1 on 2018-01-24. Score: 2

If the one in your question is your complete code, a possibility is that your computer is just buffering the output for the serial port, withholding it in memory.  Try to add
ser.flush()

after your last line.  This command will... well... flush anything into the buffer through the actual connection.


---

### Answer by username_2 on 2020-06-09. Score: 1

Sorry for the late answer, but with Repetrel v3 and later, we have the option for you to configure a secondary COM port, and relay G- or M-Code commands from your other source through the Repetrel software to the printer. Please contact us for assistance.

Note: I work for Hyrel 3D.


---

