Now the working CSV file (csv_filename in the config file) gets deleted,
reducing the trash that the program creates.
To run ad-hoc (be sure to activate the virtual environment, as detailed in the
Installation section):
-`./infoex-autowx.py --config [path/to/config-file.ini]`
+`./infoex-autowx.py --config [path/to/config-file.ini] [--dry-run]`
+
+**NOTE: Specifying --dry-run will also not clean up the generated CSV
+file.** This is so that you can debug any issues more easily.
Here's an example of a crontab(5) with two SNOTEL sites, each of which
will run once per hour (note that this will activate the virtual environment
import csv
import datetime
import logging
+import os
import sys
import time
f.close()
if not options.dry_run:
+ # not a dry run
with open(infoex['csv_filename'], 'rb') as f:
log.debug("uploading FTP file '%s'" % (infoex['host']))
ftp = FTP(infoex['host'], infoex['uuid'], infoex['api_key'])
ftp.storlines('STOR ' + infoex['csv_filename'], f)
ftp.close()
f.close()
+ os.remove(infoex['csv_filename'])
log.debug('DONE')