Skip to content

Commit

Permalink
Fix ptangle, fixes #79
Browse files Browse the repository at this point in the history
  • Loading branch information
mpastell committed Aug 28, 2017
1 parent c804466 commit a629c11
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions pweave/pweb.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ def __init__(self, source, doctype = None, *, informat = None, kernel = "python3
self.figdir = figdir
self.doctype = doctype
self.sink = None
self.kernel = None
self.language = None

if mimetype is None:
self.mimetype = MimeTypes.guess_mimetype(self.source)
Expand All @@ -50,10 +52,7 @@ def __init__(self, source, doctype = None, *, informat = None, kernel = "python3
self.file_ext = None

self.output = output

if kernel is not None:
self.setkernel(kernel)

self.setkernel(kernel)
self._setwd()

#Init variables not set using the constructor
Expand All @@ -80,7 +79,8 @@ def _setwd(self):
def setkernel(self, kernel):
"""Set the kernel for jupyter_client"""
self.kernel = kernel
self.language = kernelspec.get_kernel_spec(kernel).language
if kernel is not None:
self.language = kernelspec.get_kernel_spec(kernel).language

def getformat(self):
"""Get current format dictionary. See: http://mpastell.com/pweave/customizing.html"""
Expand Down Expand Up @@ -205,7 +205,7 @@ def tangle(self):
x['content'] = "".join([main, x['content']])
code = [x['content'] for x in code]
f = open(target, 'w')
f.write('\n'.join(code))
f.write('\n'.join(code) + "\n")
f.close()
print('Tangled code from {src} to {dst}'.format(src=self.source,
dst=target))
2 changes: 1 addition & 1 deletion tests/publish/publish_test_REF.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ def impz(b,a=1):

a = 12
b = 10
print(a+b)
print(a+b)

0 comments on commit a629c11

Please sign in to comment.