Skip to content
Merged
Show file tree
Hide file tree
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: 4 additions & 4 deletions testsou/ccpymat.dir/concore.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@

try:
iport = literal_eval(open("concore.iport").read())
except:
except Exception:
iport = dict()
try:
oport = literal_eval(open("concore.oport").read())
except:
except Exception:
oport = dict()


Expand All @@ -44,7 +44,7 @@ def read(port, name, initstr):
try:
infile = open(inpath+str(port)+"/"+name);
ins = infile.read()
except:
except (OSError, IOError):
ins = initstr
while len(ins)==0:
time.sleep(delay)
Expand All @@ -68,7 +68,7 @@ def write(port, name, val, delta=0):
outfile.write(str([simtime+delta]+val))
else:
outfile.write(val)
except:
except (OSError, IOError):
print("skipping"+outpath+str(port)+"/"+name);

def initval(simtime_val):
Expand Down
8 changes: 4 additions & 4 deletions testsou/concore.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@

try:
iport = literal_eval(open("concore.iport").read())
except:
except Exception:
iport = dict()
try:
oport = literal_eval(open("concore.oport").read())
except:
except Exception:
oport = dict()


Expand All @@ -44,7 +44,7 @@ def read(port, name, initstr):
try:
infile = open(inpath+str(port)+"/"+name);
ins = infile.read()
except:
except (OSError, IOError):
ins = initstr
while len(ins)==0:
time.sleep(delay)
Expand All @@ -68,7 +68,7 @@ def write(port, name, val, delta=0):
outfile.write(str([simtime+delta]+val))
else:
outfile.write(val)
except:
except (OSError, IOError):
print("skipping"+outpath+str(port)+"/"+name);

def initval(simtime_val):
Expand Down
30 changes: 15 additions & 15 deletions tools/cwrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,51 +12,51 @@

try:
apikey=open(concore.inpath+'1/concore.apikey',newline=None).readline().rstrip()
except:
except (OSError, IOError):
try:
#perhaps this should be removed for security
apikey=open('./concore.apikey',newline=None).readline().rstrip()
except:
except (OSError, IOError):
apikey = ''

try:
yuyu=open(concore.inpath+'1/concore.yuyu',newline=None).readline().rstrip()
except:
except (OSError, IOError):
try:
yuyu=open('./concore.yuyu',newline=None).readline().rstrip()
except:
except (OSError, IOError):
yuyu = 'yuyu'

try:
name1=open(concore.inpath+'1/concore.name1',newline=None).readline().rstrip()
except:
except (OSError, IOError):
try:
name1=open('./concore.name1',newline=None).readline().rstrip()
except:
except (OSError, IOError):
name1 = 'u'

try:
name2=open(concore.inpath+'1/concore.name2',newline=None).readline().rstrip()
except:
except (OSError, IOError):
try:
name2=open('./concore.name2',newline=None).readline().rstrip()
except:
except (OSError, IOError):
name2 = 'ym'

try:
init_simtime_u = open(concore.inpath+'1/concore.init1',newline=None).readline().rstrip()
except:
except (OSError, IOError):
try:
init_simtime_u = open('./concore.init1',newline=None).readline().rstrip()
except:
except (OSError, IOError):
init_simtime_u = "[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]"

try:
init_simtime_ym = open(concore.inpath+'1/concore.init2',newline=None).readline().rstrip()
except:
except (OSError, IOError):
try:
init_simtime_ym = open('./concore.init2',newline=None).readline().rstrip()
except:
except (OSError, IOError):
init_simtime_ym = "[0.0, 0.0, 0.0]"

logging.debug(f"API Key: {apikey}")
Expand Down Expand Up @@ -92,7 +92,7 @@
if len(r.text)!=0:
try:
t=literal_eval(r.text)[0]
except:
except Exception:
logging.error(f"bad eval {r.text}")
timeout_count = 0
t1 = time.perf_counter()
Expand All @@ -104,7 +104,7 @@
f = {'file1': open(concore.inpath+'1/'+name1, 'rb')}
try:
r = requests.post('http://www.controlcore.org/pm/'+yuyu+apikey+'&fetch='+name2, files=f,timeout=timeout_max)
except:
except Exception:
logging.error("CW: bad request")
timeout_count += 1
if r.status_code!=200 or time.perf_counter()-t1 > 1.1*timeout_max: #timeout_count>100:
Expand All @@ -113,7 +113,7 @@
if len(r.text)!=0:
try:
t=literal_eval(r.text)[0]
except:
except Exception:
logging.error(f"bad eval {r.text}")
oldt = t
oldym = r.text
Expand Down