Skip to content

Commit

Permalink
Fixed bytes to str errors in Python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
David Slater committed Sep 24, 2019
1 parent 52426bc commit 262c73c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion bin/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
settings['url_expires'] = 0
settings['cc'] = []


posting_files = []
file_checksums = {}
url = {}
Expand Down Expand Up @@ -140,7 +141,7 @@ def main():
for i in posting_files:
checksum = functions.create_md5_checksum(i)
file_checksums[i] = checksum
functions.log("File: " + i + ", MD5 checksum: " + checksum)
functions.log("File: " + i + ", MD5 checksum: " + str(checksum.decode("utf-8")))

#If Dry Run is disabled, upload files and send email
if (options.dry_run == None):
Expand Down
8 changes: 4 additions & 4 deletions lib/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ def html_email(url,md5sum,expire_date):
html += "<p>Below is the list of files and the link to download them.</p>"
html += "<p>The links (URLs) will expire on " + expire_date + "</p>"
html += "<br>"
for file_name,url_link in url.iteritems():
for file_name,url_link in url.items():
html += "<p>File: " + os.path.basename(file_name) + "</p>"
html += "<p>URL: <a href='" + url_link + "'>" + url_link + "</a></p>"
if len(md5sum):
html += "<p>md5sum: " + md5sum[file_name] + "</p>"
html += "<p>md5sum: " + str(md5sum[file_name].decode("utf-8")) + "</p>"
html += "<p>For questions about this posting, you may reply to this email and must cc: aghernan@illinois.edu and clwright@illinois.edu</p>"
html += "<p>Sincerely,</p>"
html += "<p>The DNA Sequencing Lab, University of Illinois at Urbana-Champaign</p>"
Expand All @@ -27,11 +27,11 @@ def text_email(url,md5sum,expire_date):
text += "Your sequencing results from the DNA Sequencing lab at UIUC are available for download.\n\n"
text += "Below is the list of files and the link to download them.\n\n"
text += "The links (URLs) will expire on " + expire_date + "\n\n"
for file_name, url_link in url.iteritems():
for file_name, url_link in url.items():
text += "File: " + os.path.basename(file_name) + "\n\n"
text += "URL: " + url_link + "\n\n"
if len(md5sum):
text += "md5sum: " + md5sum[file_name] + "\n\n"
text += "md5sum: " + str(md5sum[file_name].decode("utf-8")) + "\n\n"

text += "For questions about this posting, you may reply to this email and must cc: aghernan@illinois.edu and clwright@illinois.edu\n\n"
text += "Sincerely,\n\n";
Expand Down

0 comments on commit 262c73c

Please sign in to comment.