Skip to content

Commit

Permalink
made Windows compatible; close #7
Browse files Browse the repository at this point in the history
  • Loading branch information
benmaier committed Mar 29, 2019
1 parent 32ec269 commit 9c833d0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
24 changes: 16 additions & 8 deletions netwulf/interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,15 @@ def do_POST(self):

# an empty POST means the server should be stopped
if content_length == 0:
body = self.rfile.read(content_length)
self.send_response(200)
self.end_headers()
response = BytesIO()
response.write(b'Closing now.')
self.wfile.write(response.getvalue())
try:
body = self.rfile.read(content_length)
self.send_response(200)
self.end_headers()
response = BytesIO()
response.write(b'Closing now.')
self.wfile.write(response.getvalue())
except: #this should actually catch a ConnectionError for windows or firefox
pass
self.server.end_requested = True
else:
body = self.rfile.read(content_length)
Expand Down Expand Up @@ -281,8 +284,13 @@ def visualize(network,
# see whether or not the whole thing was started from a jupyter notebook and if yes,
# actually re-draw the figure and display it
env = os.environ
program = os.path.basename(env['_'])
if 'jupyter' in program:
try:
is_jupyter = 'jupyter' in os.path.basename(env['_'])
except: # this should actually be a key error
# apparently this is how it has to be on Windows
is_jupyter = 'JPY_PARENT_PID' in env

if is_jupyter:
fig, ax = wulf.draw_netwulf(posted_network_properties)


Expand Down
2 changes: 1 addition & 1 deletion netwulf/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Contains a bunch of information about this package.
"""

__version__ = "0.0.13"
__version__ = "0.0.14"

__author__ = "Ulf Aslak, Benjamin F. Maier"
__copyright__ = "Copyright 2018, Ulf Aslak, Benjamin F. Maier"
Expand Down

0 comments on commit 9c833d0

Please sign in to comment.