$ python3 s3upload.py /Users/Mike/WebSites/Weewx/newTraceback (most recent call last): File "s3upload.py", line 145, in <module> import weewxModuleNotFoundError: No module named 'weewx' .
if __name__ == '__main__': import configobj
import weewx import weeutil.logger
weewx.debug = 1
weeutil.logger.setup('S3upload', {}) if len(sys.argv) < 2: print("""Usage: s3upload.py path-to-configuration-file [path-to-be-ftp'd]""") sys.exit(weewx.CMD_ERROR)
try: config_dict = configobj.ConfigObj(sys.argv[1], file_error=True, encoding='utf-8') except IOError: print("Unable to open configuration file %s" % sys.argv[1]) raise
if len(sys.argv) == 2: try: S3_dir = os.path.join(config_dict['WEEWX_ROOT'], config_dict['StdReport']['HTML_ROOT']) except KeyError: print("No HTML_ROOT in configuration dictionary.") sys.exit(1) else: S3_dir = sys.argv[2]
S3_upload = S3Upload(config_dict['StdReport']['AWSCLI']['S3_BUCKET'], config_dict['StdReport']['AWSCLI']['AWS_Profile'], S3_dir, config_dict['StdReport']['AWSCLI']['S3_ROOT'], 'S3') S3_upload.run()
$ PYTHON_PATH=/home/weewx/bin python3 s3upload.py /Users/Mike/WebSites/Weewx/new
or
$ PYTHON_PATH=/usr/share/weewx python3 s3upload.py /Users/Mike/WebSites/Weewx/new
depending on whether you did a setup.py or package WeeWX install.
Gary