Here is a functional code (create file with success)
sys.stdout = open(\'filename1.xml\', \'w\')
Now I\'m trying to name the file with the cu
now is a class method in the class datetime in the module datetime. So you need
datetime
datetime.datetime.now()
Or you can use a different import
from datetime import datetime
Done this way allows you to use datetime.now as per the code in the question.
datetime.now