Black Lives Matter. Please consider donating to Black Girls Code today.

Can I output the value of variables?

Apologies is this is a very basic question, but how can I see the value of variables within a callback?

I’ve tried

print(i)

but nothing seems to happen.

I’m really struggling to debug my dash application. Looking forward to the debugger working …

Thanks,

John.

print should work. you should also be able to insert a debugger in your callbacks like
import ipdb
ipdb.set_trace()

if this doesn’t work, could you share a small reproducible example?

I’m launching python from sublime text.

print(‘here we go’)

if name == ‘main’:
app.run_server(debug=True)

gives me

here we go

  • Restarting with stat …

In the output area at the bottom of sublime text

However, if I add print to my callback

@app.callback(Output(‘workflowTable’,‘rows’),
[Input(‘addFolderButton’,‘n_clicks’),
Input(‘copyFolderButton’,‘n_clicks’),
Input(‘cutFolderButton’,‘n_clicks’),
Input(‘pasteFolderButton’,‘n_clicks’),
Input(‘deleteFolderButton’,‘n_clicks’),
Input(‘upFolderButton’,‘n_clicks’),
Input(‘downFolderButton’,‘n_clicks’)],
[State(‘workflowTable’,‘selected_row_indices’)])
def folder_toolbar_callback(b1, b2, b3, b4, b5, b6, b7, selectedFolders):
global folder_toolbar_state

print('add_folder')

Then I get nothing.