diff --git a/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py b/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py
index 8df675d8f1e2c43af78f6493168e7956e6ae924b..3921afd8f25f0f41badb5ce9f2c040fab866b7d6 100755
--- a/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py
+++ b/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py
@@ -58,6 +58,7 @@ from lib_autotest import *
 def find_open_port():
    global serial_port, ser
    max_ports=100
+   serial_port=''
    while True:
      if os.path.exists(serial_port) == True:
        return serial_port
diff --git a/cmake_targets/autotests/tools/configure_cots_huaweiE398_ue.py b/cmake_targets/autotests/tools/configure_cots_huaweiE398_ue.py
index eaa0c8298aae54eaa0f300c862d70cf238dbffe7..9646cc69ffe99493a1c0d82a172b1ad1fa4846c6 100755
--- a/cmake_targets/autotests/tools/configure_cots_huaweiE398_ue.py
+++ b/cmake_targets/autotests/tools/configure_cots_huaweiE398_ue.py
@@ -58,6 +58,7 @@ from lib_autotest import *
 def find_open_port():
    global serial_port, ser
    max_ports=100
+   serial_port=''
    while True:
      if os.path.exists(serial_port) == True:
        return serial_port