Variables in debug mode

已回答

I have a function that uses a global variable, 'c', as part of a SQL query (although I'm assuming the fact it's part of a SQL query is not important):

 

def myfunc(a, b):

       df = pd.read_sql('select * from {var}'.format(var=c))

       ...

 

when in debug mode I can't access c, it's not available to me. As a workaround, I tried to define c using both the debugger prompt and the 'evaluate' function; this *looks like* it works; i.e. 'c' appears in my varibable list; but the debugger doesn't recognise it.

 

So, how can I define/access my 'c' variable?

 

Cheers,

 

Graham

0

Hi! Where is it defined? Is it in global scope? In Variables Pane we show only local variables for current frame (in your case it's a, b, pd, df). But you can add `c` variable to Watches pane and it's value will be shown for you.

0

请先登录再写评论。