Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

mssparkutils catch exception

Hello everyone!

I want to run a notebook with mssparkutils but want to continue with the code execution if the called notebook run fails, analog to having pipeline items in sequence "upon completion". Is this possible, and if so, how?

So far I tried:

 

import sys

try:
    mssparkutils.notebook.run("00_Broken_Notebook")
except:  # catch *all* exceptions
    e = sys.exc_info()[0]
    write_to_page("<p>Error: %s</p>" % e)

 

Thanks for any help!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

Thanks for using Fabric Community.
Below code is working for me -

Test Notebook 1 -

vgchennamsft_1-1715835083276.png

 


Test Notebook 2 -

 

import logging

try:
    mssparkutils.notebook.run("Test Notebook 1")
except Exception as e:
    logging.exception(e)
    print("it is running")

 

 

vgchennamsft_2-1715835162654.png

 


Hope this is helpful. Do let me know incase of further queries.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

Thanks for using Fabric Community.
Below code is working for me -

Test Notebook 1 -

vgchennamsft_1-1715835083276.png

 


Test Notebook 2 -

 

import logging

try:
    mssparkutils.notebook.run("Test Notebook 1")
except Exception as e:
    logging.exception(e)
    print("it is running")

 

 

vgchennamsft_2-1715835162654.png

 


Hope this is helpful. Do let me know incase of further queries.

Anonymous
Not applicable

Hi @Anonymous ,

Glad to know that your query got resolved. Please continue using Fabric Community on your further queries.

Helpful resources

Announcements
Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Free Fabric Certifications

Free Fabric Certifications

Get Fabric certified for free! Don't miss your chance.

January Fabric Update Carousel

Fabric Monthly Update - January 2026

Check out the January 2026 Fabric update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.