Is there a way to find the source of an error in Python with no file name?
<p>I've been getting several mystery errors after my program completes and exits successfully. There were 3, but I fixed the "Nonetype" error by making a second import of an Agilent library local instead of global, I assume it was freeing the same object twice. But I still get these two:</p>

<pre><code>Exception ctypes.ArgumentError?: "argument 2: &lt;type 'exceptions.TypeError?'&gt;: wrong type" in ignored
Exception ctypes.ArgumentError?: "argument 2: &lt;type 'exceptions.TypeError?'&gt;: wrong type" in ignored
</code></pre>

<p>I'm not using ctypes. The error could be in libraries I am importing: selenium, pyvisa/visa, or labjack/labjackpython. I tried importing some of those libraries locally but that didn't seem to change anything.</p>

<p>Is there a way to hunt down the source of errors like this? A file name and line number would be great. Thanks</p>

<p>You can start your script with a <a href="https://wiki.python.org/moin/PythonDebuggingTools" rel="nofollow">python debugger</a> or use a tool like GDB or strace to run your python program.</p>

<p>The python debuggers may fail to dig into imported compiled libraries, but with the other two you can get a stack trace which should show the library that causes the exception.</p>

python selenium visa