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):
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
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 csv
import datetime
import logging
f.close()
if not options.dry_run:
f.close()
if not options.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()
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'])