ver Dec20th
fixed bug caused by windows-only os.startfile
This commit is contained in:
@@ -4,9 +4,10 @@ import platform
|
|||||||
import subprocess
|
import subprocess
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
import Xlib.display
|
#import Xlib.display
|
||||||
import pyautogui
|
import pyautogui
|
||||||
from PIL import ImageGrab, Image
|
#from PIL import ImageGrab, Image
|
||||||
|
from PIL import Image
|
||||||
from flask import Flask, request, jsonify, send_file
|
from flask import Flask, request, jsonify, send_file
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
@@ -180,7 +181,11 @@ def open_file():
|
|||||||
return f"File not found: {path}", 404
|
return f"File not found: {path}", 404
|
||||||
|
|
||||||
try:
|
try:
|
||||||
os.startfile(path)
|
if platform.system()=="Windows":
|
||||||
|
os.startfile(path)
|
||||||
|
else:
|
||||||
|
open_cmd: str = "open" if platform.system()=="Darwin" else "xdg-open"
|
||||||
|
subprocess.Popen([open_cmd, str(path)])
|
||||||
return "File opened successfully"
|
return "File opened successfully"
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return f"Failed to open {path}. Error: {e}", 500
|
return f"Failed to open {path}. Error: {e}", 500
|
||||||
|
|||||||
2
main.py
2
main.py
@@ -15,7 +15,7 @@ def human_agent():
|
|||||||
env = DesktopEnv( path_to_vm="/home/david/vmware/KUbuntu 64-bit/KUbuntu 64-bit.vmx"
|
env = DesktopEnv( path_to_vm="/home/david/vmware/KUbuntu 64-bit/KUbuntu 64-bit.vmx"
|
||||||
, action_space="computer_13"
|
, action_space="computer_13"
|
||||||
#, snapshot_path="base_setup"
|
#, snapshot_path="base_setup"
|
||||||
, snapshot_path="Init5"
|
, snapshot_path="Init6"
|
||||||
, instruction=example["instruction"]
|
, instruction=example["instruction"]
|
||||||
, config=example["config"]
|
, config=example["config"]
|
||||||
, evaluator=example["evaluator"]
|
, evaluator=example["evaluator"]
|
||||||
|
|||||||
Reference in New Issue
Block a user