Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error concat byte with string #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions lightning/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def _append_image(self, image):

def _append_data(self, data=None, field=None):
payload = {'data': data}
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
url = self.session.host + '/sessions/' + str(self.session.id) + '/visualizations/' + str(self.id) + '/data/'
if field:
url += field
Expand All @@ -51,7 +51,7 @@ def _append_data(self, data=None, field=None):

def _update_data(self, data=None, field=None):
payload = {'data': data}
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
url = self.session.host + '/sessions/' + str(self.session.id) + '/visualizations/' + str(self.id) + '/data/'
if field:
url += field
Expand Down Expand Up @@ -194,7 +194,7 @@ def save_html(self, filename=None, overwrite=False):
os.remove(filename)
with open(filename, "wb") as f:
f.write(base.encode('utf-8'))
f.write('<script>' + js.encode('utf-8') + '</script>')
f.write(b'<script>' + js.encode('utf-8') + b'</script>')

@staticmethod
def load_template():
Expand All @@ -208,5 +208,3 @@ def load_embed():
location = os.path.join(os.path.dirname(__file__), 'lib/embed.js')
import codecs
return codecs.open(location, "r", "utf-8").read()