Apr-01-2020, 04:57 PM
(This post was last modified: Apr-01-2020, 04:57 PM by deanhystad.)
Ooops! I missed sys.stdout = open(filename.strftime("%d %B %Y")+".txt", "w"). Even has a file extension. Hmmm, oh well.
So what isn't working? Is the file created? Does the file contain "Total number of rows in pncnetwork is:"? What do you see after that?
If the file is not created, is it a permissions problem? Where are you trying to create the file? Or are you getting an exception. A problem with redirecting stdout to a file is this doesn't work:
So what isn't working? Is the file created? Does the file contain "Total number of rows in pncnetwork is:"? What do you see after that?
If the file is not created, is it a permissions problem? Where are you trying to create the file? Or are you getting an exception. A problem with redirecting stdout to a file is this doesn't work:
except Exception as e: print("ERROR ", str(e))You would need to print that to stderr. If your really want to redirect stdout I would leave out exception handling until things are working.