try:copy=os.path.dirname(__file__)exceptNameError:# __file__ does not exist when run with sphinx-gallerycopy="."paths_to_try=[os.path.join("..","notebooks"),os.path.join("_doc","notebooks")]forpathinpaths_to_try:src=os.path.abspath(path)ifos.path.exists(src):breaksrc=os.path.abspath(src)synchronize_folder(src,dest,fLOG=print)