Karthik | Langtrace AI
Karthik | Langtrace AI
WWindmill
Created by Karthik | Langtrace AI on 6/2/2024 in #help
Decorators with def main() not working in python
I am running into the following issue when I use a decorator with def main()
error:
ExecutionErr: error during execution of the script:
Error parsing code: Got unexpected EOF at byte offset 617
error:
ExecutionErr: error during execution of the script:
Error parsing code: Got unexpected EOF at byte offset 617
Wondering if this is windmill runtime specific config issue? It works well if I use the decorator on any other method and call it inside main. See below the code:
def my_decorator(func):
def wrapper():
print("Something is happening before the function is called.")
func()
print("Something is happening after the function is called.")
return wrapper

@my_decorator
def main():
print("The main function is running.")
def my_decorator(func):
def wrapper():
print("Something is happening before the function is called.")
func()
print("Something is happening after the function is called.")
return wrapper

@my_decorator
def main():
print("The main function is running.")
4 replies