1

Can anyone explain the following stack trace, in step by step, please? I want to find out what the root cause of the error is and where the error originates from.

Traceback (most recent call last):

1.   File "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensio ns\Microsoft\Python Tools for Visual Studio\2.1\visualstudio_py_util.py", line 1 06, in exec_file
    exec_code(code, file, global_variables)

2.   File "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensio ns\Microsoft\Python Tools for Visual Studio\2.1\visualstudio_py_util.py", line 8 2, in exec_code
    exec(code_obj, global_variables)

3.  File "C:\Users\ssr\FindAllCandidatePathsOfTrain.py", line 332, in <module>
    main()

4.      File "C:\Users\ssr\FindAllCandidatePathsOfTrain.py", line 296, in main
    stanoxDetails = checkTheLineHasStanox(lastLineSegment)

5.      File "C:\Users\ssr\FindAllCandidatePathsOfTrain.py", line 205, in checkTheLineHasStanox
    firstrow= query(queryStr, 'GetOne')

6.      File "C:\Users\ssr\FindAllCandidatePathsOfTrain.py", line 45, in query
    connection.close()

7.      File "C:\Python34\lib\site-packages\pypyodbc.py", line 2658, in close
    self.rollback()

8.      File "C:\Python34\lib\site-packages\pypyodbc.py", line 2581, in rollback
    check_success(self, ret)

9.      File "C:\Python34\lib\site-packages\pypyodbc.py", line 988, in check_success
    ctrl_err(SQL_HANDLE_DBC, ODBC_obj.dbc_h, ret, ODBC_obj.ansi)

10.      File "C:\Python34\lib\site-packages\pypyodbc.py", line 966, in ctrl_err
    raise DatabaseError(state,err_text) pypyodbc.DatabaseError: ('08S01', '[08S01] [Microsoft][ODBC SQL Server Driver]Co mmunication
link failure') 
Press any key to continue . . .
Newbie
  • 95
  • 9

2 Answers2

2

A Python Traceback will show you what was being executed before the error occured as well as the line it error-ed on.

In this case, your module raised an error on this line:

File "C:\Python34\lib\site-packages\pypyodbc.py", line 966, in ctrl_err
raise DatabaseError(state,err_text)

And the error text is shown here:

pypyodbc.DatabaseError: ('08S01', '[08S01] [Microsoft][ODBC SQL Server Driver]Communication link failure')
John Marshall
  • 314
  • 5
  • 9
  • If I number the statements in the Traceback (the way I've numbered them in the original post), then based on what you said and what we can see on the Traceback, is it a valid assumption that the error was caused by something in step 5 or 6? I'm assuming that the visualstudio_py_util.py and pypyodbc.py files are error-free. – Newbie Dec 16 '15 at 18:26
  • Yes thats the best assumption to make, if lines 5 and 6 are reffering to your files (which it looks like they are) then that is probably what is causing this error. I don't know much about pypyodbc, but if I had to guess what exactly your error was I think it might be line 6 where you close the connection because the error raised says "Communication link failure" – John Marshall Dec 16 '15 at 23:11
2

The traceback shows you the lines of code executed before the error occurred and the error itself, as mentioned. Python isn't the direct cause of the error in this case.

Consider:

10.      File "C:\Python34\lib\site-packages\pypyodbc.py", line 966, in ctrl_err
raise DatabaseError(state,err_text) pypyodbc.DatabaseError: ('08S01', '[08S01] [Microsoft][ODBC SQL Server Driver]Communication link failure')

What this shows is that this error in Python is a "pass-through" error. The database driver being called is actually the cause of the error, and Python is simply passing that through Python. Good luck.

FlipperPA
  • 13,607
  • 4
  • 39
  • 71