Fix calling log function
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import logs
|
||||
import os
|
||||
import json
|
||||
from ducky import run_script_file
|
||||
from ducky import run_script_file, run_script
|
||||
|
||||
|
||||
def create(path, contents=b""):
|
||||
@@ -31,4 +31,7 @@ def handle(body, response):
|
||||
elif action == "create":
|
||||
create(filename)
|
||||
elif action == "run":
|
||||
run_script_file(path)
|
||||
if filename is not None:
|
||||
run_script_file(path)
|
||||
elif contents := body["contents"]:
|
||||
run_script(contents)
|
||||
|
||||
@@ -66,7 +66,7 @@ def run_script(contents):
|
||||
millis = default_delay
|
||||
delay(millis)
|
||||
elif message := after("PRINT"):
|
||||
log(message, logs)
|
||||
log(message)
|
||||
elif path := after("IMPORT"):
|
||||
run_script_file(path)
|
||||
elif millis := after("DEFAULT_DELAY", "DEFAULTDELAY"):
|
||||
@@ -87,4 +87,4 @@ def run_script_file(path: str):
|
||||
with open(path, "r", encoding="utf-8") as handle:
|
||||
run_script(handle.read())
|
||||
except OSError as e:
|
||||
log(f"unable to open file {path}: {e}")
|
||||
log(f"warning: unable to open file {path}: {e}")
|
||||
|
||||
@@ -93,6 +93,8 @@ documents_icon.addEventListener('click', () => {
|
||||
run_icon.addEventListener('click', () => {
|
||||
if (title.value != "") {
|
||||
doApi({"action": "run", "filename": title.value})
|
||||
} else {
|
||||
doApi({"action": "run", "contents": editor.value})
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user