# ERROR none type object has no attribute writeBytes

**URL:** <https://forum.inductiveautomation.com/t/error-none-type-object-has-no-attribute-writebytes/60079>\
**Category:** Ignition\
**Tags:** ignition81, vision\
**Created:** [May 26, 2022, 3:56pm UTC](https://forum.inductiveautomation.com/t/error-none-type-object-has-no-attribute-writebytes/60079 "2022-05-26T15:56:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Esmeralda\_Lopez](https://avatars.discourse-cdn.com/v4/letter/e/fbc32d/32.png) [@Esmeralda\_Lopez](https://forum.inductiveautomation.com/u/Esmeralda_Lopez)\
**Post date:** [May 26, 2022, 3:56pm UTC](https://forum.inductiveautomation.com/t/error-none-type-object-has-no-attribute-writebytes/60079/1 "2022-05-26T15:56:04Z")

</div>

Hello everyone, I have a problem when I get this error and then says that the port can not be opened

 ![WhatsApp Image 2022-05-26 at 10.53.18 AM](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/2/8246634cc0ada40f8200ac0aba7fafa823ff6c63.jpeg)

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [May 26, 2022, 3:58pm UTC](https://forum.inductiveautomation.com/t/error-none-type-object-has-no-attribute-writebytes/60079/2 "2022-05-26T15:58:45Z")

</div>

There’s a problem with your code. Without seeing your code (ideally, posted here in plain text format inside a preformatted block) we can’t help.

---

<div class="post-metadata">

**Author:** ![Esmeralda\_Lopez](https://avatars.discourse-cdn.com/v4/letter/e/fbc32d/32.png) [@Esmeralda\_Lopez](https://forum.inductiveautomation.com/u/Esmeralda_Lopez)\
**Post date:** [May 26, 2022, 4:11pm UTC](https://forum.inductiveautomation.com/t/error-none-type-object-has-no-attribute-writebytes/60079/3 "2022-05-26T16:11:08Z")

</div>

I will do it the next time I got this error because we are in tests, the thing is that there is an script in background and stays there but we don’t know why

---

<div class="post-metadata">

**Author:** ![Esmeralda\_Lopez](https://avatars.discourse-cdn.com/v4/letter/e/fbc32d/32.png) [@Esmeralda\_Lopez](https://forum.inductiveautomation.com/u/Esmeralda_Lopez)\
**Post date:** [May 26, 2022, 4:42pm UTC](https://forum.inductiveautomation.com/t/error-none-type-object-has-no-attribute-writebytes/60079/4 "2022-05-26T16:42:41Z")

</div>

[AWT-EventQueue-0] Error com.inductiveautomation.ignition.client.util.gui.ErrorUtil - Error running function from `fpmi.system.invokeAsynchronous`

com.inductiveautomation.ignition.common.script.jythonExecException: AttributeError: ‘NoneType’ object has no attribute ‘writeBytes’  
at org.python.core.PyException.doRaise(PyException.java:211)  
at org.python.core.PymakeException(Py.java: 1638)  
at org.python.core.PymakeException(Py.java: 1642)  
at org.python.core.PymakeException(Py.java: 1646)  
at org.python.core.PymakeException(Py.java: 1650)  
at.org.python.pycode.\_pyx36.e$1(module:funcionesAutoSeguroLineas:52)  
at org.python.pycode.\_pyx36.call\_function(module:funcionesAutoSeguroLineas)  
at.org.python.core.PyTableCode.call(PyTableCode.java:173)  
at.org.python.core.PyBaseCode.call(PyBaseCode.java:168)  
at.org.python.core.PyFunction._call_(PyFunction.java:437)  
at.org.python.pycode.\_pyx36.threadSectorImpar$3(module:funcionesAutoSeguroLineas:211)  
at.org.python.pycode._pyx36.call\_function(module:funcionesAutoSeguroLineas)  
at.org.python.core.PyTableCode.call(PyTableCode.java:173)  
at.org.python.core.PyBaseCode.call(PyTableCode.java:306)  
at.org.python.core.PyFunction.function\_call_(PyFunction.java:474)  
at.org.python.core.PyFunction._call_(PyFunction.java:469)  
at.org.python.core.PyFunction._call_(PyFunction.java:464)  
at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:849)  
at com.inductiveautomation.ignition.client.script.DesignerSystemUtilities.lambda$\_invokeAsyncImpl$1(DesignerSystemUtilities.java:140)  
at java.base/java.lang.Thread.run(Unknow Source)  
Caused by: org.python.core.PyException:AttributeError: ‘NoneType’ object has no attribute ‘writeBytes’  
…20 common frames omitted

[AWT-EventQueue-0] Error com.inductiveautomation.ignition.client.util.gui.ErrorUtil - Error running function from `fmpi.system.invokeAsynchronous`  
com.inductiveautomation.ignition.common.script.JythonExceException: java.io.IOException: java.io.IOException: Port COM9 has not been opened.

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [May 26, 2022, 4:45pm UTC](https://forum.inductiveautomation.com/t/error-none-type-object-has-no-attribute-writebytes/60079/5 "2022-05-26T16:45:39Z")

</div>

In your `funcionesAutoSeguroLineas` script library, are you calling `system.util.invokeAsynchronous` somewhere? Seems like you are and it’s happening within that call.

Post your `funcionesAutoSeguroLineas` script

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 26, 2022, 4:46pm UTC](https://forum.inductiveautomation.com/t/error-none-type-object-has-no-attribute-writebytes/60079/6 "2022-05-26T16:46:33Z")

</div>

> [@Esmeralda\_Lopez](#):
>
> com.inductiveautomation.ignition.common.script.JythonExceException: java.io.IOException: java.io.IOException: Port COM9 has not been opened.

I think this is relevant.
