Apr-01-2020, 07:59 PM
(Apr-01-2020, 04:57 PM)deanhystad Wrote: 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:
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.
The file gets created however the data for number of rows, and also the rows caller out in the print line are not placed in the file, it’s just blank. I’m not sure what or where I did this incorrectly