Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
Signed-off-by: wwqgtxx <[email protected]>
  • Loading branch information
wwqgtxx committed Jun 13, 2016
1 parent fdb3e23 commit 4dc1acf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
4 changes: 2 additions & 2 deletions wwqLyParse/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def parse():
info=sys.exc_info()
result = {"type" : "error","error" : info}
jjson = json.dumps(result);
#debug(jjson)
debug(jjson)
return jjson


Expand All @@ -199,7 +199,7 @@ def parseUrl():
info=sys.exc_info()
result = {"type" : "error","error" : info}
jjson = json.dumps(result);
#debug(jjson)
debug(jjson)
return jjson


Expand Down
21 changes: 16 additions & 5 deletions wwqLyParse/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
# author wwqgtxx <[email protected]>

import urllib.request,json,sys,subprocess
import urllib.request,json,sys,subprocess,time

import os
import socket
Expand All @@ -27,13 +27,21 @@ def _run_main():
y_bin = bridge.pn(bridge.pjoin(bridge.get_root_path(), './main.py'))
py_bin = sys.executable
args = [py_bin,'--normal', y_bin]
PIPE = subprocess.PIPE
print(args)
p = subprocess.Popen(args, stdout=PIPE, stderr=PIPE, shell=False,cwd=bridge.get_root_path())
p = subprocess.Popen(args, shell=False,cwd=bridge.get_root_path(),close_fds=True)

def init():
if not IsOpen("127.0.0.1",5000):
return _run_main()
for n in range(3):
if not IsOpen("127.0.0.1",5000):
_run_main()
else:
return
for i in range(5):
if not IsOpen("127.0.0.1",5000):
time.sleep(1+i)
else:
return
raise Exception("can't init server")

def closeServer():
if IsOpen("127.0.0.1",5000):
Expand All @@ -45,6 +53,9 @@ def closeServer():
response = urllib.request.urlopen(req)
except:
response = None;

def Cleanup():
closeServer()

def GetVersion(debug=False):
if (not debug):
Expand Down

0 comments on commit 4dc1acf

Please sign in to comment.