shethjenil
commited on
Commit
•
360749d
1
Parent(s):
9b0cc9e
Upload 2 files
Browse files- .gitattributes +1 -0
- pyimageserverrun.exe +3 -0
- pyimageserverrun.py +29 -0
.gitattributes
CHANGED
@@ -50,3 +50,4 @@ BROWSER.exe filter=lfs diff=lfs merge=lfs -text
|
|
50 |
CLOUDSOFTWARE.exe filter=lfs diff=lfs merge=lfs -text
|
51 |
hiddensoftware.exe filter=lfs diff=lfs merge=lfs -text
|
52 |
pytoserver.exe filter=lfs diff=lfs merge=lfs -text
|
|
|
|
50 |
CLOUDSOFTWARE.exe filter=lfs diff=lfs merge=lfs -text
|
51 |
hiddensoftware.exe filter=lfs diff=lfs merge=lfs -text
|
52 |
pytoserver.exe filter=lfs diff=lfs merge=lfs -text
|
53 |
+
pyimageserverrun.exe filter=lfs diff=lfs merge=lfs -text
|
pyimageserverrun.exe
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a337eaebf8a2d7ec3823e998a9124b1943bb5f7caa2d1015ad54053261d1b739
|
3 |
+
size 7862904
|
pyimageserverrun.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from argparse import ArgumentParser
|
2 |
+
from zipfile import ZipFile
|
3 |
+
from subprocess import Popen, PIPE
|
4 |
+
from shutil import rmtree
|
5 |
+
|
6 |
+
argparser = ArgumentParser()
|
7 |
+
argparser.add_argument("-i", "--image", type=str, help="app image", required=True)
|
8 |
+
argparser.add_argument("-p", "--port", type=int, default=12345, help="port number")
|
9 |
+
argparser.add_argument("-f", "--folder", type=str, default="appfolder", help="app folder")
|
10 |
+
argparser.add_argument("-a", "--address", type=str, default="0.0.0.0", help="address to listen on")
|
11 |
+
args = argparser.parse_args()
|
12 |
+
|
13 |
+
folder = args.folder
|
14 |
+
rmtree(folder, ignore_errors=True)
|
15 |
+
ZipFile(args.image).extractall(folder)
|
16 |
+
try:
|
17 |
+
process = Popen([folder + "\\main", "-p", str(args.port), "-a", str(args.address)], stdout=PIPE, stderr=PIPE, shell=True)
|
18 |
+
while True:
|
19 |
+
output = process.stdout.readline()
|
20 |
+
if output == b"" and process.poll() is not None:
|
21 |
+
break
|
22 |
+
if output:
|
23 |
+
if "Running a app" in output.decode():
|
24 |
+
print("Setup complete")
|
25 |
+
process.wait()
|
26 |
+
except Exception as e:
|
27 |
+
print(f"An error occurred: {e}")
|
28 |
+
finally:
|
29 |
+
rmtree(folder)
|