This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: distutils command 'upload' crashes when --show-response is selected
Type: crash Stage: resolved
Components: Distutils Versions: Python 2.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: "python setup.py sdist upload --show-response" can fail with "UnboundLocalError: local variable 'result' referenced before assignment"
View: 10367
Assigned To: tarek Nosy List: eric.araujo, offby1, tarek
Priority: normal Keywords:

Created on 2011-05-01 13:42 by offby1, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
upload-failed.log offby1, 2011-05-01 13:42
Messages (5)
msg134908 - (view) Author: Chris Rose (offby1) * Date: 2011-05-01 13:42
When running distutils like so:

.tox/py27/bin/python setup.py -v bdist_egg upload --show-response 

Eventually, after everything else spools by, this pops up:


Using PyPI login from /Users/offline/.pypirc
Submitting dist/PyHamcrest-1.5-py2.7.egg to http://pypi.python.org/pypi
Upload failed (401): You must be identified to edit package information
Traceback (most recent call last):
  File "setup.py", line 69, in <module>
    setup(**all_params)
  File "/usr/local/Cellar/python/2.7.1/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/local/Cellar/python/2.7.1/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/local/Cellar/python/2.7.1/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/local/Cellar/python/2.7.1/lib/python2.7/distutils/command/upload.py", line 60, in run
    self.upload_file(command, pyversion, filename)
  File "/usr/local/Cellar/python/2.7.1/lib/python2.7/distutils/command/upload.py", line 193, in upload_file
    msg = '\n'.join(('-' * 75, r.read(), '-' * 75))
NameError: global name 'r' is not defined
msg135071 - (view) Author: Chris Rose (offby1) * Date: 2011-05-03 21:17
I can see that this is only an error in the 2.7.1 release, and is fixed in distutils on the 2.7 branch (along with other bugs, too, from what I can see.)

I'm closing it as invalid, given that.
msg135138 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-05-04 16:08
Are you sure?  This looks like #10367 (unsolved yet), not #9199 (fixed).
msg135139 - (view) Author: Chris Rose (offby1) * Date: 2011-05-04 16:12
No, not 100% sure, but my read of the 2.7 branch code certainly seemed to suggest that it was fixed.

in distutil/commands/upload.py:

Line 193 gets the response unconditionally as 'r' from the http object

Line 201 uses 'r' to show the response.

I might be missing a form that the 'r' object can take that isn't going to have a read() method, but I doubt it.
msg135140 - (view) Author: Chris Rose (offby1) * Date: 2011-05-04 16:13
... oh, except I'm an idiot, and I think I'm reading tip code there. 

Yep, I'm an idiot.

Okay, but this is still a dupe of #10367
History
Date User Action Args
2022-04-11 14:57:16adminsetgithub: 56179
2011-05-04 16:14:41eric.araujosetsuperseder: "python setup.py sdist upload --show-response" can fail with "UnboundLocalError: local variable 'result' referenced before assignment"
stage: resolved
2011-05-04 16:13:32offby1setresolution: not a bug -> duplicate
messages: + msg135140
2011-05-04 16:12:03offby1setmessages: + msg135139
2011-05-04 16:08:32eric.araujosetmessages: + msg135138
2011-05-03 21:17:09offby1setstatus: open -> closed
resolution: not a bug
messages: + msg135071
2011-05-01 13:42:20offby1create