You are not logged in.

#1 2018-10-03 06:23:45

epaaj
Member
Registered: 2011-08-10
Posts: 6

smem - xrange is not defined - Python version issue

When using smem I stumbled upon this issue when trying to get display bars using this command:

smem -t -k --bar=vss

The error I get is this below. It seems it's trying to run a Python 2 application with Python 3.

Traceback (most recent call last):
  File "/usr/bin/smem", line 727, in <module>
    showpids()
  File "/usr/bin/smem", line 299, in showpids
    showtable(pt.keys(), fields, columns.split(), options.sort or 'pss')
  File "/usr/bin/smem", line 558, in showtable
    showbar(l, columns, sort)
  File "/usr/bin/smem", line 649, in showbar
    for n in xrange(len(rc)):
NameError: name 'xrange' is not defined

I'm not sure what I can do. Is there a way of running it with Python 2? Should I report this as a package bug for Arch or does this need to be fixed upstreams by the developer?
I found this old thread where some guys are talking about making smem Python 3 compatible. But it seems nothing was ever done.
https://selenic.com/pipermail/smem/2014 … 00183.html

Offline

#2 2018-10-03 13:32:21

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,524
Website

Re: smem - xrange is not defined - Python version issue

I can confirm the error.  You can run smem via python2:

python2 /bin/smem ...

Or you can edit the shebang in /bin/smem directly to use python2.  This would require python2-matplotlib (rather than python-matplotlib).

It looks like this could be a valid bug to go to our tracker to repackage this will a modified shebang and python2 dependencies.

EDIT: if smem is supposed to be a python3 script, then it is an upstream issue that should be reported upstream.  But as it seems it is python2 code, it looks more like an arch packaging issue to me.

EDIT2: I confirmed it works fine with python2 and python2 dependencies.

Last edited by Trilby (2018-10-03 13:34:39)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2018-10-03 21:19:05

loqs
Member
Registered: 2014-03-06
Posts: 17,362

Re: smem - xrange is not defined - Python version issue

https://git.archlinux.org/svntogit/comm … f39f4735f2
Please file a bug report on the arch bug tracker about the issue.

Offline

Board footer

Powered by FluxBB