I’m currently making my first steps with the python api. I have created a small script, that should query a table using base.query(). But unfortunately i’m getting an error, that i cannot explain:
Exception has occurred: TypeError
unsupported operand type(s) for +: 'NoneType' and 'str'
File "/grocy2seatable/run-export.py", line 34, in <module>
query_result = base.query(sql_query, convert=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
Here is my small code snippet, that causes the error:
for item in stock_items:
print(f"processing {item.name}")
# create seatable row
str_id = str(item.id)
sql_query = f"select Id, Name from Produkte where id = {str_id}"
# when executing this line i get the error above
query_result = base.query(sql_query, convert=True)
anyone can give me a hint what could be wrong?
I’m running my script from my local machine against the official cloud instance of seatable.
Tried that also. I also deleted some columns from my table as i thought, it would cause an issue like here.
Current snippet is:
for item in stock_items:
print(f"processing {item.name}")
# create seatable row
sql_query = f"select Id, Name from Produkte where id = '{str(item.id)}'"
query_result = base.query(sql_query)
Exception has occurred: TypeError
unsupported operand type(s) for +: 'NoneType' and 'str'
File "run-export.py", line 29, in <module>
product_rows = base.list_rows(products_table_name, "Default View")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
Am i doing something basically wrong?
I also reinstalled the dependencies using
pip install -r requirements.txt
my requirements.txt is as follows
pygrocy
socketIO-client-nexus
requests
This is how i initialize my base object:
seatable_url = environ["SEATABLE_URL"]
seatable_api_key = environ["SEATABLE_TOKEN"]
base = Base(seatable_api_key, seatable_url)