Beomann
Beomann

Reputation: 1

Could not find module taos while using TDengine connector

I'm using TDengine database to process time-series data. My application is developed by Python. I imported the Python connector of TDengine. I encountered an error while loading the python module.

taos.error.InterfaceError: [0xffff]: unable to load taos C library:Could not find module taos (or one of its dependencies)

I don't know how to fix it.

I checked the documentation, but no solution was found.

Upvotes: 0

Views: 357

Answers (1)

Mialli
Mialli

Reputation: 1

I got the same error importing taos. I changed to taosws and it looks good.

Mainly, I was running this code taken from: https://github.com/taosdata/taos-connector-python#execute-many

import taos

conn = taos.connect()
cursor = conn.cursor()

db_name = "test_db"

cursor.execute(f"DROP DATABASE IF EXISTS {db_name}")
cursor.execute(f"CREATE DATABASE {db_name}")
cursor.execute(f"USE {db_name}")

cursor.execute("create stable stb (ts timestamp, v1 int) tags(t1 int)")

create_table_data = [
    {
        "name": "tb1",
        "t1": 1,
    },
    {
        "name": "tb2",
        "t1": 2,
    },
    {
        "name": "tb3",
        "t1": 3,
    }
]

cursor.execute_many(
    "create table {name} using stb tags({t1})",
    create_table_data,
)
cursor.execute("show databases")
results = cursor.fetchall()
for row in results:
    print(row)

I changed taos into taosws (line 1 and line 3) and all seems to be correctly functioning.

Upvotes: 0

Related Questions