Files
dxfmakros/lib/testpycall.py

30 lines
738 B
Python

"""testpycall.py - Testskript fuer LISP-Python-Aufruf."""
import os
import sys
from datetime import datetime
def main():
if len(sys.argv) > 1:
log_dir = sys.argv[1]
else:
log_dir = os.getenv("DXFM_LOG", ".")
os.makedirs(log_dir, exist_ok=True)
log_file = os.path.join(log_dir, "testpycall.log")
return_file = os.path.join(log_dir, "testpycall_return.txt")
timestamp = datetime.now().strftime("%y%m%d-%H:%M:%S")
message = f"{timestamp} - been called from BricsCAD LISP via CALLPYTHON\n"
with open(log_file, "a", encoding="utf-8") as f:
f.write(message)
with open(return_file, "w", encoding="utf-8") as f:
f.write(timestamp)
if __name__ == "__main__":
main()