# I cant use python function a lot of errors keep appearing

**URL:** <https://discourse.nodered.org/t/i-cant-use-python-function-a-lot-of-errors-keep-appearing/54878>\
**Category:** General\
**Created:** [8 December 2021 13:57 UTC](https://discourse.nodered.org/t/i-cant-use-python-function-a-lot-of-errors-keep-appearing/54878 "2021-12-08T13:57:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mahmoud19](https://avatars.discourse-cdn.com/v4/letter/m/9dc877/32.png) [@Mahmoud19](https://discourse.nodered.org/u/Mahmoud19)\
**Post date:** [8 December 2021 13:57 UTC](https://discourse.nodered.org/t/i-cant-use-python-function-a-lot-of-errors-keep-appearing/54878/1 "2021-12-08T13:57:11Z")

</div>

I cant use the python function a lot of errors keep appearing on debug panel  
deploying is successful but when I inject or run it keep showing 4 error on debug  
these are the 4 errors

```auto
**Traceback (most recent call last):**
 **File "<string>", line 67, in <module>**

  **File "C:\Python310\lib\json\ __init__.py", line 341, in loads**

  **s = s.decode(detect_encoding(s), 'surrogatepass')**
 **File "C:\Python310\lib\encodings\utf_32_le.py", line 11, in decode**
**return codecs.utf_32_le_decode(input, errors, True)**
**UnicodeDecodeError: 'utf-32-le' codec can't decode bytes in position 16-19: code point not in range(0x110000)**

**"Python Function process exited with code 1"**

```

so should I do ? 😔

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 December 2021 15:08 UTC](https://discourse.nodered.org/t/i-cant-use-python-function-a-lot-of-errors-keep-appearing/54878/2 "2021-12-08T15:08:00Z")

</div>

Welcome to the forum @Mahmoud19

I know others have had problems with the python function node. I advise against using it. Instead you can either implement the code in javascript or use an exec node to run a python script.

---

<div class="post-metadata">

**Author:** ![Mahmoud19](https://avatars.discourse-cdn.com/v4/letter/m/9dc877/32.png) [@Mahmoud19](https://discourse.nodered.org/u/Mahmoud19)\
**Post date:** [8 December 2021 18:18 UTC](https://discourse.nodered.org/t/i-cant-use-python-function-a-lot-of-errors-keep-appearing/54878/3 "2021-12-08T18:18:00Z")

</div>

the problem is that I have computer vision with plc project so I should use python for computer vision, visual script cant be used for computer vision

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [8 December 2021 18:48 UTC](https://discourse.nodered.org/t/i-cant-use-python-function-a-lot-of-errors-keep-appearing/54878/4 "2021-12-08T18:48:38Z")

</div>

So yes use python script to do the vision work and call it from an exec node if you want the results in node-red

---

<div class="post-metadata">

**Author:** ![Mahmoud19](https://avatars.discourse-cdn.com/v4/letter/m/9dc877/32.png) [@Mahmoud19](https://discourse.nodered.org/u/Mahmoud19)\
**Post date:** [8 December 2021 19:27 UTC](https://discourse.nodered.org/t/i-cant-use-python-function-a-lot-of-errors-keep-appearing/54878/5 "2021-12-08T19:27:34Z")

</div>

oh i get it now, thank u soooo mucccchhhhh

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [22 December 2021 19:28 UTC](https://discourse.nodered.org/t/i-cant-use-python-function-a-lot-of-errors-keep-appearing/54878/6 "2021-12-22T19:28:15Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
