diff --git a/nbconvert/exporters/exporter.py b/nbconvert/exporters/exporter.py index f033d3330..f90e07432 100644 --- a/nbconvert/exporters/exporter.py +++ b/nbconvert/exporters/exporter.py @@ -148,7 +148,12 @@ def from_filename(self, filename, resources=None, **kw): Ignored """ - + # Convert full filename string to unicode + # In python 2.7.x if filename comes as unicode string, + # just skip converting it. + if isinstance(filename, str): + filename = py3compat.str_to_unicode(filename) + # Pull the metadata from the filesystem. if resources is None: resources = ResourcesDict() diff --git a/nbconvert/exporters/pdf.py b/nbconvert/exporters/pdf.py index b0879a78d..6de07d0da 100644 --- a/nbconvert/exporters/pdf.py +++ b/nbconvert/exporters/pdf.py @@ -7,7 +7,7 @@ import os import sys -from ipython_genutils.py3compat import which, cast_bytes_py2 +from ipython_genutils.py3compat import which, cast_bytes_py2, getcwd from traitlets import Integer, List, Bool, Instance, Unicode from testpath.tempdir import TemporaryWorkingDirectory from .latex import LatexExporter @@ -165,7 +165,7 @@ def from_notebook_node(self, nb, resources=None, **kw): if resources and resources.get('metadata', {}).get('path'): self.texinputs = resources['metadata']['path'] else: - self.texinputs = os.getcwd() + self.texinputs = getcwd() self._captured_outputs = [] with TemporaryWorkingDirectory():