WindmillWWindmill
Powered by
Karthik | Langtrace AIK
Windmill•2y ago•
10 replies
Karthik | Langtrace AI

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.")
WindmillJoin
3,362Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?
Recent Announcements
henri-c

Weekly kenote to tell you about our latest updates https://discord.com/channels/930051556043276338/1278977038430240813 https://youtube.com/live/2dGd9TdT8xs?feature=share

henri-c · 4d ago

Pyra

### HTTP tracing (EE) Capture HTTP requests made by job scripts as observability spans Features: - View HTTP request traces (method, URL, status, timing) in the job details UI - Auto-instrumentation for Native TypeScript, MITM proxy for other languages - Integrates with external OpenTelemetry collectors changelog: https://www.windmill.dev/changelog/http-tracing docs: https://www.windmill.dev/docs/advanced/instance_settings#http-tracing Additionally jobs memory metrics are now fully OSS!

Pyra · 2w ago

henri-c

First keynote of the year here https://discord.com/channels/930051556043276338/1278977038430240813 🙂

henri-c · 4w ago

Similar Threads

Sub module not working with Python
MarkyMMarky / help
2y ago
Can I use async main function in python?
Dylan ParkDDylan Park / help
3y ago
Working with (CSV) file output and python in scripts/workflows
stair_spiritSstair_spirit / help
3y ago
Logging in Python Script
Alexander EiseleAAlexander Eisele / help
2y ago