SULDR Forums Supported Printers Printing Questions Scanning Questions General Questions Samsung Installer

IndexError: list index out of range

Started by JohnVeness, September 23, 2013, 15:54:08

Previous topic - Next topic

JohnVeness

When installing suld-scantopc on my Ubuntu 12.04 system, I get the following:

Setting up suld-scantopc (0.4.3-1) ...
* Starting Samsung Scanner Server samsungScannerServer                         Traceback (most recent call last):
  File "/usr/bin/samsungScannerServer.py", line 25, in <module>
    import pysnmp
  File "/usr/lib/pymodules/python2.7/pysnmp/__init__.py", line 27, in <module>
    switchApiVersion(subDirs[-1])  # take the most recent version
IndexError: list index out of range
                                                                         [fail]
invoke-rc.d: initscript samsungScannerServer, action "start" failed.
dpkg: error processing suld-scantopc (--configure):
subprocess installed post-installation script returned error exit status 1
No apport report written because MaxReports has already been reached
                                                                    Errors were encountered while processing:
suld-scantopc

totally-king

Have you changed your installation of python modules, especially pysnmp? Maybe you should try purging and reinstalling python-pysnmp-common via apt?

In my configuration (default python installation in ubuntu 12.10) the __init__.py script that throws your error is located in /usr/lib/python2.7/dist-packages/pysnmp and contains only:

# PySNMP, version 4
majorVersionId = '4'
version = (4, 2, 1)

JohnVeness

I haven't changed anything python-wise on my PC that I'm aware of. I've just done:

sudo apt-get remove --purge python-pysnmp-common suld-scantopc
sudo apt-get install python-pysnmp-common suld-scantopc

but still same error. For info, file /usr/lib/pymodules/python2.7/pysnmp/__init__.py on my machine contains:
"""Various components of SNMP applications"""
import os
import sys
import string

def switchApiVersion(subPkg):
    pkg = os.path.split(__path__[0])[-1]
    newMod = __import__(subPkg, globals(), locals())
    realPkg = '_real_' + pkg
    if sys.modules.has_key(realPkg):
        sys.modules[pkg] = sys.modules[realPkg]
    sys.modules[realPkg] = sys.modules[pkg]
    sys.modules[pkg] = newMod

def __isSubPackage(subDir):
    if subDir and subDir[0] == 'v' and subDir[1] in string.digits \
           and len(subDir) == 2:
        return 1

if os.environ.has_key('PYSNMP_API_VERSION'):
    v = os.environ['PYSNMP_API_VERSION']
    if v:
        switchApiVersion(v)   # do not load any API
else:
    subDirs = filter(__isSubPackage, os.listdir(__path__[0]))
    subDirs.sort();
    switchApiVersion(subDirs[-1])  # take the most recent version

totally-king

Well, you've got me stumped! You could try

sudo apt-get remove --purge python-pysnmp* suld-scantopc
sudo apt-get install suld-scantopc

since the -common package is only a version selection module in 12.04 (as I know now ^^).

Or maybe you installed a repository that gave you this non-working python module? To check this:

apt-cache showpkg python-pysnmp*

JohnVeness

I don't have any python-pysnmp* packages installed other than python-pysnmp-common, so the command "sudo apt-get remove --purge python-pysnmp* suld-scantopc" is effectively the same as that I tried earlier when I did "sudo apt-get remove --purge python-pysnmp-common suld-scantopc". Similarly, as suld-scantopc depends on python-pysnmp-common, "sudo apt-get install suld-scantopc" is effectively the same as my earlier "sudo apt-get install python-pysnmp-common suld-scantopc".

Results of "apt-cache showpkg python-pysnmp*":

$ apt-cache showpkg python-pysnmp*
Package: python-pysnmp4-mibs
Versions:
0.0.5a-3 (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_precise_universe_binary-amd64_Packages)
Description Language:
                 File: /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_precise_universe_binary-amd64_Packages
                  MD5: 4d910d562d6819676403e21fdfc85c61
Description Language: en
                 File: /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_precise_universe_i18n_Translation-en
                  MD5: 4d910d562d6819676403e21fdfc85c61


Reverse Depends:
  python-pysnmp4-apps,python-pysnmp4-mibs
  python-pysnmp4,python-pysnmp4-mibs
Dependencies:
0.0.5a-3 - python (2 2.3) python-support (2 0.7.1) python-pysnmp4 (0 (null))
Provides:
0.0.5a-3 -
Reverse Provides:
Package: python-pysnmp2
Versions:
2.0.9-3build1 (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_precise_universe_binary-amd64_Packages)
Description Language:
                 File: /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_precise_universe_binary-amd64_Packages
                  MD5: 9d65852c40999bea819ff638b0a72fff
Description Language: en
                 File: /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_precise_universe_i18n_Translation-en
                  MD5: 9d65852c40999bea819ff638b0a72fff


Reverse Depends:
  python-pysnmp-common,python-pysnmp2 2.0.9-3~
  python-pysnmp-common,python-pysnmp2 2.0.9-3~
Dependencies:
2.0.9-3build1 - python (2 2.3) python-support (2 0.90.0) python-pysnmp-common (2 4.1.9a-2~) python2.3-pysnmp2 (0 (null)) python2.3-pysnmp2:i386 (0 (null)) python2.4-pysnmp2 (0 (null)) python2.4-pysnmp2:i386 (0 (null)) python2.3-pysnmp2 (0 (null)) python2.3-pysnmp2:i386 (0 (null)) python2.4-pysnmp2 (0 (null)) python2.4-pysnmp2:i386 (0 (null))
Provides:
2.0.9-3build1 - python2.7-pysnmp2
Reverse Provides:
Package: python-pysnmp4
Versions:
4.1.9a-2ubuntu1 (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_precise_universe_binary-amd64_Packages)
Description Language:
                 File: /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_precise_universe_binary-amd64_Packages
                  MD5: 25a5a15d4bfcd2b1bab54aa39b5b36c7
Description Language: en
                 File: /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_precise_universe_i18n_Translation-en
                  MD5: 25a5a15d4bfcd2b1bab54aa39b5b36c7


Reverse Depends:
  suld-scantopc,python-pysnmp4
  python-pysnmp4-mibs,python-pysnmp4
  python-pysnmp4-apps,python-pysnmp4
  python-pysnmp-common,python-pysnmp4 4.1.9a-2~
  python-pysnmp-common,python-pysnmp4
Dependencies:
4.1.9a-2ubuntu1 - python (2 2.3) python-support (2 0.90.0) libsmi2ldbl (0 (null)) libsmi2-common (0 (null)) python-pyasn1 (0 (null)) python-pysnmp-common (2 4.1.9a-2~) python-pysnmp4-doc (0 (null)) python-crypto (0 (null)) python-pysnmp4-mibs (0 (null)) python-pysnmp4-apps (0 (null))
Provides:
4.1.9a-2ubuntu1 -
Reverse Provides:
Package: python-pysnmp4-doc
Versions:
4.1.9a-2ubuntu1 (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_precise_universe_binary-amd64_Packages)
Description Language:
                 File: /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_precise_universe_binary-amd64_Packages
                  MD5: ced80cc8a84da02dadbc80ab71f55810
Description Language: en
                 File: /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_precise_universe_i18n_Translation-en
                  MD5: ced80cc8a84da02dadbc80ab71f55810


Reverse Depends:
  python-pysnmp4,python-pysnmp4-doc
Dependencies:
4.1.9a-2ubuntu1 -
Provides:
4.1.9a-2ubuntu1 -
Reverse Provides:
Package: python-pysnmp4-apps
Versions:
0.2.6a-1 (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_precise_universe_binary-amd64_Packages)
Description Language:
                 File: /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_precise_universe_binary-amd64_Packages
                  MD5: 48f4459f9591a899685a3e0eeff3464a
Description Language: en
                 File: /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_precise_universe_i18n_Translation-en
                  MD5: 48f4459f9591a899685a3e0eeff3464a


Reverse Depends:
  python-pysnmp4,python-pysnmp4-apps
Dependencies:
0.2.6a-1 - python (2 2.3) python-pysnmp4 (0 (null)) python-support (2 0.7.1) python-pysnmp4-mibs (0 (null))
Provides:
0.2.6a-1 -
Reverse Provides:
Package: python-pysnmp-common
Versions:
4.1.9a-2ubuntu1 (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_precise_universe_binary-amd64_Packages)
Description Language:
                 File: /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_precise_universe_binary-amd64_Packages
                  MD5: 3058eb9d693cba73624c3eb520a99936
Description Language: en
                 File: /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_precise_universe_i18n_Translation-en
                  MD5: 3058eb9d693cba73624c3eb520a99936


Reverse Depends:
  suld-scantopc,python-pysnmp-common 2.0
  python-pysnmp4,python-pysnmp-common 4.1.9a-2~
  python-pysnmp2,python-pysnmp-common 4.1.9a-2~
Dependencies:
4.1.9a-2ubuntu1 - python (2 2.3) python-support (2 0.90.0) python-pysnmp4 (0 (null)) python-pysnmp2 (3 2.0.9-3~) python-pysnmp2:i386 (3 2.0.9-3~) python-pysnmp4 (3 4.1.9a-2~) python-pysnmp4:i386 (3 4.1.9a-2~) python-pysnmp2 (3 2.0.9-3~) python-pysnmp2:i386 (3 2.0.9-3~)
Provides:
4.1.9a-2ubuntu1 -
Reverse Provides:

JohnVeness

Quote from: JohnVeness on October 02, 2013, 10:30:07
I don't have any python-pysnmp* packages installed other than python-pysnmp-common...
Actually, is that the problem? I notice when I do "sudo apt-get install suld-scantopc" without either python-pysnmp-common or suld-scantopc installed I get:

The following extra packages will be installed:
  python-pysnmp-common
Recommended packages:
  python-pysnmp4
The following NEW packages will be installed
  python-pysnmp-common suld-scantopc

That is, python-pysnmp4 is only "Recommended" and so doesn't get installed by default.

totally-king

So it's definitely not the package that's corrupted ...
You could try backing up and removing the the pysnmp directory and maybe other files named something like that in /usr/lib/pymodules/python2.7/. Maybe then python will find the correct source installed by apt. (Check your Python's search path to find out in which order directories are checked: http://docs.python.org/2/install/index.html#modifying-python-s-search-path.)

JohnVeness

I'm afraid I only generally work with packages and don't feel comfortable modifying the filesystem by hand. If I manually install python-psysnmp4, I no longer get the error message.

I guess the question is why doesn't python-psysnmp4 automatically get installed when I install suld-scantopc?

totally-king

Good! Nice to know that it works now.

If you look at the package it says

Depends: python-pysnmp-common (>= 2.0) | python-pysnmp4


Well, I thought either of these packages should be working. Did anyone else have problems installing, because python-pysnmp-common wasn't enough and python-pysnmp4 was needed?

bchemnet

On most Debian/Ubuntu systems, recommended packages are treated as dependencies and automatically installed.  So this would likely not show up for most people, even though python-pysnmp4 is (apparently) required.

Unless there is some reason not, I will update the dependecies when I re-package this weekend.

Repository Information Legal Contact Alternative Drivers