Trying to connect a python script to our filemaker db. It was working with a previous copy of db but recently connecting to new version, it started throwing an error "list index out of range" when trying to grab a table from the DB.
Using Python 3.7.4, pypyodbc 1.3.4, and filemaker Pro 13.0v3 Also using Filemaker ODBC driver 13.2.14
query = 'SELECT * FROM Projects'
con_str = "DSN=%s;Database=%s;UID=%s;PWD=%s" % (DSN, DB, User, PW)
with pypyodbc.connect(con_str) as connection:
cursor = connection.cursor()
cursor.execute(query)
The connection is correctly established or at least, returns the correct object. And I assure there is a table that corresponds to the query:
Some previous noise regarding a similar error that supposedly has been resolved in subsequent releases: pypyodbc execute returns list index out of range error
also tried setting Autocommit to True, but still get error:
Any help is appreciated.
Edit - added traceback per request:
<ipython-input-8-de64dadd5741> in <module>
4 with pypyodbc.connect(con_str, autocommit = True) as connection:
5 cursor = connection.cursor()
----> 6 cursor.execute(query)
7 import pdb; pdb.set_trace()
8
~\AppData\Local\Continuum\anaconda3\envs\submittal_client_env\lib\site-packages\pypyodbc.py in execute(self, query_string, params, many_mode, call_mode)
1624
1625 else:
-> 1626 self.execdirect(query_string)
1627 return self
1628
~\AppData\Local\Continuum\anaconda3\envs\submittal_client_env\lib\site-packages\pypyodbc.py in execdirect(self, query_string)
1652 check_success(self, ret)
1653 self._NumOfRows()
-> 1654 self._UpdateDesc()
1655 #self._BindCols()
1656 return self
~\AppData\Local\Continuum\anaconda3\envs\submittal_client_env\lib\site-packages\pypyodbc.py in _UpdateDesc(self)
1774 10, ADDR(c_short()),ADDR(Cdisp_size))
1775 if ret != SQL_SUCCESS:
-> 1776 check_success(self, ret)
1777
1778 if force_unicode:
~\AppData\Local\Continuum\anaconda3\envs\submittal_client_env\lib\site-packages\pypyodbc.py in check_success(ODBC_obj, ret)
1005 if ret not in (SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_NO_DATA):
1006 if isinstance(ODBC_obj, Cursor):
-> 1007 ctrl_err(SQL_HANDLE_STMT, ODBC_obj.stmt_h, ret, ODBC_obj.ansi)
1008 elif isinstance(ODBC_obj, Connection):
1009 ctrl_err(SQL_HANDLE_DBC, ODBC_obj.dbc_h, ret, ODBC_obj.ansi)
~\AppData\Local\Continuum\anaconda3\envs\submittal_client_env\lib\site-packages\pypyodbc.py in ctrl_err(ht, h, val_ret, ansi)
970 #No more data, I can raise
971 #print(err_list[0][1])
--> 972 state = err_list[0][0]
973 err_text = raw_s('[')+state+raw_s('] ')+err_list[0][1]
974 if state[:2] in (raw_s('24'),raw_s('25'),raw_s('42')):
IndexError: list index out of range`enter code here`
enter code here