upload.py: more fixes for py3
Merge pull request #572 from piranha/patch-2

upload.py: more fixes for py3