Your message dated Sat, 15 Oct 2016 14:23:43 +1100
with message-id <20161015032342.3yn5hiytvd25y...@benfinney.id.au>
and subject line Re: Bug#761980: program not importing ‘platform’ from standard 
library
has caused the Debian Bug report #761980,
regarding program not importing ‘platform’ from standard library
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)


-- 
761980: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=761980
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Package: python-pkg-resources
Version: 5.5.1-1
Severity: normal

Dear Maintainer,

I installed the slimit package and, lacking a man page, ran
 slimit --help
Instead of help I got
<quote>
Traceback (most recent call last):
  File "/usr/bin/slimit", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1189, in 
<module>
    class MarkerEvaluation(object):
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1193, in 
MarkerEvaluation
    'python_full_version': platform.python_version,
AttributeError: 'module' object has no attribute 'python_version'
</quote>
which wasn't much use.  The problem is that last stack frame, in
pkg_resources.py, where
<quote>
import platform
...
class MarkerEvaluation(object):
    values = {
        'os_name': lambda: os.name,
        'sys_platform': lambda: sys.platform,
        'python_full_version': platform.python_version,
        'python_version': lambda: platform.python_version()[:3],
...
</quote>
presumes that the module platform has python_version as an attribute
(that is, no less, callable returning a sequence).  A quick python
session:
<quote>
Python 2.7.8 (default, Sep  9 2014, 23:55:56) 
[GCC 4.9.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.python_version
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'python_version'
>>> platform.version
<function version at 0xb72aa56c>
>>> platform.version()
'#1 SMP Debian 3.14.15-2 (2014-08-09)'
>>> import sys
>>> sys.version
'2.7.8 (default, Sep  9 2014, 23:55:56) \n[GCC 4.9.1]'
</quote>
reveals that this is an unrealistic expectation.
Continuing,
<quote>
>>> import pkg_resources
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pkg_resources.py", line 1189, in <module>
    class MarkerEvaluation(object):
  File "pkg_resources.py", line 1193, in MarkerEvaluation
    'python_full_version': platform.python_version,
AttributeError: 'module' object has no attribute 'python_version'
</quote>
I verify that the problem resides entirely within pkg_resources; it
has nothing to do with how slimit is using it.

Commenting out the python_full_version and python_version entries in
values (quoted above), I discover python_implementation is also a
mythical attribute of platform.  Commenting *that* out, I find I am
finally able to import pkg_resources; and slimit --help actually runs,
albeit producing only minimal help.  I don't know what else may be
broken by it, but here's the patch I'm left using:
<patch>
diff -bu /usr/lib/python2.7/dist-packages/pkg_resources.py.orig 
/usr/lib/python2.7/dist-packages/pkg_resources.py
--- /usr/lib/python2.7/dist-packages/pkg_resources.py.orig      2014-08-10 
19:36:30.000000000 +0200
+++ /usr/lib/python2.7/dist-packages/pkg_resources.py   2014-09-17 
15:00:55.183904273 +0200
@@ -1190,11 +1190,11 @@
     values = {
         'os_name': lambda: os.name,
         'sys_platform': lambda: sys.platform,
-        'python_full_version': platform.python_version,
-        'python_version': lambda: platform.python_version()[:3],
+        #'python_full_version': platform.python_version,
+        #'python_version': lambda: platform.python_version()[:3],
         'platform_version': platform.version,
         'platform_machine': platform.machine,
-        'python_implementation': platform.python_implementation,
+        #'python_implementation': platform.python_implementation,
     }
 
     @classmethod

Diff finished.  Wed Sep 17 15:07:54 2014
</patch>

This makes pkg_resources.py unusable (can't import it) and makes at
least one other package unusable (slimit, because it expects to be
able to import pkg_resources).

-- System Information:
Debian Release: jessie/sid
  APT prefers testing-updates
  APT policy: (500, 'testing-updates'), (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 3.14-2-686-pae (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages python-pkg-resources depends on:
pn  python:any  <none>

python-pkg-resources recommends no packages.

Versions of packages python-pkg-resources suggests:
pn  python-distribute      <none>
pn  python-distribute-doc  <none>

-- no debconf information

--- End Message ---
--- Begin Message ---
Control: tags -1 - moreinfo + unreproducible
Control: notfound -1 python-setuptools/5.5.1-1

On 13-Oct-2016, Edward Welbourne wrote:

> ... or a platform.py earlier in my custom PYTHONPATH - which, now
> that I know what to look for, is exactly the problem.
> 
> PEBKAC - sorry to waste your time - please close this bug,

Thanks for confirming.

-- 
 \     “I went camping and borrowed a circus tent by mistake. I didn't |
  `\      notice until I got it set up. People complained because they |
_o__)                           couldn't see the lake.” —Steven Wright |
Ben Finney <bign...@debian.org>

Attachment: signature.asc
Description: PGP signature


--- End Message ---

Reply via email to