Updates
This commit is contained in:
parent
363ffc40ce
commit
b2504f49f9
5
upload
5
upload
@ -25,7 +25,7 @@ def find_ais(path):
|
|||||||
return [Ai(x) for x in os.listdir(path) if not x.startswith('__')]
|
return [Ai(x) for x in os.listdir(path) if not x.startswith('__')]
|
||||||
|
|
||||||
def upload_ai(ai):
|
def upload_ai(ai):
|
||||||
print_yellow("Zipping " + ai.name + "...")
|
print_yellow("Zipping the AI...")
|
||||||
zip = zipfile.ZipFile('.archive.zip', mode = 'w')
|
zip = zipfile.ZipFile('.archive.zip', mode = 'w')
|
||||||
try:
|
try:
|
||||||
for file in os.listdir(AIS_DIR + "/" + ai.path):
|
for file in os.listdir(AIS_DIR + "/" + ai.path):
|
||||||
@ -33,12 +33,15 @@ def upload_ai(ai):
|
|||||||
finally:
|
finally:
|
||||||
zip.close()
|
zip.close()
|
||||||
|
|
||||||
|
print_yellow("Uploading the AI...")
|
||||||
try:
|
try:
|
||||||
subprocess.check_call([
|
subprocess.check_call([
|
||||||
'curl', '-X', 'POST', '-F', 'archive=@.archive.zip', '-F', 'name=' + ai.name,
|
'curl', '-X', 'POST', '-F', 'archive=@.archive.zip', '-F', 'name=' + ai.name,
|
||||||
'http://pytron.tforgione.fr/upload-target/'],
|
'http://pytron.tforgione.fr/upload-target/'],
|
||||||
stderr = subprocess.DEVNULL,
|
stderr = subprocess.DEVNULL,
|
||||||
stdout = subprocess.DEVNULL)
|
stdout = subprocess.DEVNULL)
|
||||||
|
|
||||||
|
print_green("Upload finished!")
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
print_red('An error occured while uploading the AI...')
|
print_red('An error occured while uploading the AI...')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user