Skip to content

Commit

Permalink
Merge pull request #41 from ivanov/use-realpath
Browse files Browse the repository at this point in the history
robust css/preamble path finding despite symlinks
  • Loading branch information
Carreau committed Oct 28, 2012
2 parents bd92b04 + 2af1087 commit 3149095
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions nbconvert.py
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ def header_body(self):
static = os.path.join(path.get_ipython_package_dir(),
'frontend', 'html', 'notebook', 'static',
)
here = os.path.split(os.path.abspath(__file__))[0]
here = os.path.split(os.path.realpath(__file__))[0]
css = os.path.join(static, 'css')
for sheet in [
# do we need jquery and prettify?
Expand Down Expand Up @@ -996,8 +996,7 @@ def convert(self):
]
# Load our own preamble, which is stored next to the main file. We
# need to be careful in case the script entry point is a symlink
myfile = __file__ if not os.path.islink(__file__) else \
os.readlink(__file__)
myfile = os.path.realpath(__file__)
with open(os.path.join(os.path.dirname(myfile), 'preamble.tex')) as f:
final.append(f.read())

Expand Down

0 comments on commit 3149095

Please sign in to comment.