Merge branch 'zdy'
This commit is contained in:
@@ -4,9 +4,10 @@ import platform
|
||||
import subprocess
|
||||
import requests
|
||||
|
||||
import Xlib.display
|
||||
#import Xlib.display
|
||||
import pyautogui
|
||||
from PIL import ImageGrab, Image
|
||||
#from PIL import ImageGrab, Image
|
||||
from PIL import Image
|
||||
from flask import Flask, request, jsonify, send_file
|
||||
|
||||
app = Flask(__name__)
|
||||
@@ -180,7 +181,11 @@ def open_file():
|
||||
return f"File not found: {path}", 404
|
||||
|
||||
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"
|
||||
except Exception as e:
|
||||
return f"Failed to open {path}. Error: {e}", 500
|
||||
|
||||
Reference in New Issue
Block a user