in my program I have undefined variable somewhere:
global name 'cmd' is not defined
How can I pull out the line number where the variable is being used?
I know where the error is (cmd versus self.cmd). The question is how to get the line number (or why it isnt shown).
Since I was catching error, I had to traceback.print_exc() to get line numbers
Where are you running your program? a Python stacktrace usually looks like this:
As you can see it indicates the line where the error is happening.