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: platform.platform() throws exception on modified debian distribution
Type: behavior Stage: test needed
Components: Library (Lib) Versions: Python 2.6
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: lemburg Nosy List: brian.curtin, lemburg, tejas81
Priority: normal Keywords:

Created on 2010-03-16 22:38 by tejas81, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg101198 - (view) Author: tejas (tejas81) Date: 2010-03-16 22:38
I am calling platform.linux_distribution() and platform.platform() on a modified Debian distribution with Python 2.6.
FWIW the file /etc/debian_version exists on this machine, but is empty.

On calling platform.platform(), it seems to try to read the linux version from /etc/debian_version, but crashes with the following exception:

Python 2.6 (r26:66714, Mar  4 2010, 13:02:59)
[GCC 3.3.5 (Debian 1:3.3.5-13)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.platform()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.6/platform.py", line 1524, in platform
    distname,distversion,distid = dist('')
  File "/usr/local/lib/python2.6/platform.py", line 361, in dist
    full_distribution_name=0)
  File "/usr/local/lib/python2.6/platform.py", line 333, in linux_distribution
    _distname, _version, _id = _parse_release_file(firstline)
  File "/usr/local/lib/python2.6/platform.py", line 269, in _parse_release_file
    return '', version, id
UnboundLocalError: local variable 'version' referenced before assignment
msg101212 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2010-03-17 03:17
Duplicate of #7773 which was fixed with r77735.
History
Date User Action Args
2022-04-11 14:56:58adminsetgithub: 52407
2010-03-17 03:17:29brian.curtinsetstatus: open -> closed

nosy: + brian.curtin
messages: + msg101212

resolution: duplicate
2010-03-17 00:24:03r.david.murraysetpriority: normal
type: crash -> behavior
stage: test needed
2010-03-16 22:46:12benjamin.petersonsetassignee: lemburg

nosy: + lemburg
2010-03-16 22:38:28tejas81create