#22364 closed Bug (fixed)
changepassword fails on Windows
| Reported by: | John Paulett | Owned by: | John Paulett |
|---|---|---|---|
| Component: | contrib.auth | Version: | 1.6 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
"manage.py changepassword" fails on Windows 2008 R2 and Windows 7 due to getpass receiving an unicode string.
C:\project>manage.py changepassword bob
Changing password for user 'bob'
Traceback (most recent call last):
djangorecipe.manage.main('test_project.settings')
File "C:\project\vendor\djangorecipe\src\djangorecipe\manage.py", line 9, in main
management.execute_from_command_line(sys.argv)
File "C:\project\eggs\django-1.6.2-py2.7.egg\django\core\management\__init__.py", line 399, in execute_from_command_line
utility.execute()
File "C:\project\eggs\django-1.6.2-py2.7.egg\django\core\management\__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\project\eggs\django-1.6.2-py2.7.egg\django\core\management\base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "C:\project\eggs\django-1.6.2-py2.7.egg\django\core\management\base.py", line 285, in execute
output = self.handle(*args, **options)
File "C:\project\eggs\django-1.6.2-py2.7.egg\django\contrib\auth\management\commands\changepassword.py", line 50, in handle
p1 = self._get_pass()
File "C:\project\eggs\django-1.6.2-py2.7.egg\django\contrib\auth\management\commands\changepassword.py", line 21, in _get_pass
p = getpass.getpass(prompt=prompt)
File "C:\Python27\lib\getpass.py", line 95, in win_getpass
msvcrt.putch(c)
TypeError: must be char, not unicode
Related to #19807, which had the same error in createsuperuser on Windows. I have tested the same solution to force_str and it resolves the issue (Pull Request is incoming). On other OSes, everything works fine.
This appears to be a regression was introduced in 1.5 and is still present today. changepassword on Windows worked under 1.4. It definitely seems relevant to include in the 1.7 release and potentially as a bug fix release for 1.5 & 1.6. I found no other reports of this error, so there does not seem to be a large affected population, but would be helpful to me to have as part of any upcoming 1.6.x bug fix release (I do have a workaround under 1.6 until then).
Change History (5)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:3 by , 12 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Issued Pull Request 2503. Verified fix in application on Windows 7. All tests passing using default runtests.py.