Skip to content

Commit 2056b1b

Browse files
committed
Give OS path to nbconvert if possible
1 parent f5e9e2e commit 2056b1b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

notebook/nbconvert/handlers.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,13 @@ def get(self, format, path):
8484
exporter = get_exporter(format, config=self.config, log=self.log)
8585

8686
path = path.strip('/')
87+
# If the notebook relates to a real file (default contents manager),
88+
# give its path to nbconvert.
89+
if hasattr(self.contents_manager, '_get_os_path'):
90+
os_path = self.contents_manager._get_os_path()
91+
else:
92+
os_path = ''
93+
8794
model = self.contents_manager.get(path=path)
8895
name = model['name']
8996
if model['type'] != 'notebook':
@@ -100,7 +107,7 @@ def get(self, format, path):
100107
"name": name[:name.rfind('.')],
101108
"modified_date": (model['last_modified']
102109
.strftime(text.date_format)),
103-
"path" : path
110+
"path" : os_path
104111
},
105112
"config_dir": self.application.settings['config_dir'],
106113
}

0 commit comments

Comments
 (0)