-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
35 lines (30 loc) · 1.11 KB
/
__init__.py
File metadata and controls
35 lines (30 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from datetime import datetime
import os
import traceback
from .server import AbletonCopilotServer
def log(msg: str):
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f")[:-3]
log_line = f"[{timestamp}] {msg}\n"
try:
with open(os.path.expanduser('~/Desktop/copilot_live.log'), 'a') as f:
f.write(log_line)
except Exception as e:
print(f"Error writing to log file: {e}")
def create_instance(c_instance):
"""
This function is called by Ableton Live when the script is loaded.
It must return an instance of your main script class.
"""
log("AbletonCopilotServer initializing...")
try:
return AbletonCopilotServer(c_instance, log)
except Exception as e:
error_info = {
'error_type': type(e).__name__,
'error_msg': str(e),
'stack_trace': traceback.format_exc()
}
log(f"Failed to initialize AbletonCopilotServer:\n"
f"Error Type: {error_info['error_type']}\n"
f"Error Message: {error_info['error_msg']}\n"
f"Stack Trace:\n{error_info['stack_trace']}\n")