Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3149095

Browse files
committed
Merge pull request #41 from ivanov/use-realpath
robust css/preamble path finding despite symlinks
2 parents bd92b04 + 2af1087 commit 3149095

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

nbconvert.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ def header_body(self):
774774
static = os.path.join(path.get_ipython_package_dir(),
775775
'frontend', 'html', 'notebook', 'static',
776776
)
777-
here = os.path.split(os.path.abspath(__file__))[0]
777+
here = os.path.split(os.path.realpath(__file__))[0]
778778
css = os.path.join(static, 'css')
779779
for sheet in [
780780
# do we need jquery and prettify?
@@ -996,8 +996,7 @@ def convert(self):
996996
]
997997
# Load our own preamble, which is stored next to the main file. We
998998
# need to be careful in case the script entry point is a symlink
999-
myfile = __file__ if not os.path.islink(__file__) else \
1000-
os.readlink(__file__)
999+
myfile = os.path.realpath(__file__)
10011000
with open(os.path.join(os.path.dirname(myfile), 'preamble.tex')) as f:
10021001
final.append(f.read())
10031002

0 commit comments

Comments
 (0)