Refine
This commit is contained in:
4
main.py
4
main.py
@@ -153,10 +153,12 @@ async def fastapi_dump_inp(network: str, inp: str) -> bool:
|
|||||||
# 必须用这个PlainTextResponse,不然每个key都有引号
|
# 必须用这个PlainTextResponse,不然每个key都有引号
|
||||||
@app.get("/runproject/", response_class = PlainTextResponse)
|
@app.get("/runproject/", response_class = PlainTextResponse)
|
||||||
async def fastapi_run_project(network: str) -> str:
|
async def fastapi_run_project(network: str) -> str:
|
||||||
filename = 'lock.simulation'
|
filename = 'c:/lock.simulation'
|
||||||
if os.path.exists(filename):
|
if os.path.exists(filename):
|
||||||
|
print('file exists')
|
||||||
raise HTTPException(status_code=409, detail="is in simulation")
|
raise HTTPException(status_code=409, detail="is in simulation")
|
||||||
else:
|
else:
|
||||||
|
print('file doesnt exists')
|
||||||
f = open(filename, "w")
|
f = open(filename, "w")
|
||||||
f.write("locksimulaiton")
|
f.write("locksimulaiton")
|
||||||
f.close()
|
f.close()
|
||||||
|
|||||||
Reference in New Issue
Block a user