How come my Python code doesn't work?
Question: from celery.decorators import task

    
    
    from celery.decorators import task
    @task()
    def add(x, y):
        r = open("./abc.txt","w")
        r.write("sdf")
        r.close()
        return x + y
    

That's my tasks.py file.

    
    
    >>> import tasks
    >>> r = tasks.add.delay(3,5)
    >>> r.result
    8
    

As you can see, the function works. However, **the file does not create**.
Why?

I've tried changing multiple file paths, due to possible permission issues.
but no luck.


Answer: If the file was not being written, you would get an exception, so the function
cannot possibly complete.

Since the function is returning 8, it follows that the file is being written
somewhere.

Perhaps the file is written in a different directory to the one you are
expecting

The only other possibility I can think of is that the add function that is
being run is not the one that you have shown here

