text: By a slip of the keys I issued the command:
  sudo rm /usr/bin/python*
  and with that the problems started. Python still starts, but when I now want to do anything with dpkg I get this error (entire error message not included as it is long):
  AttributeError: 'module' object has no attribute 'pydebug'
  dpkg: error while cleaning up:
  subprocess installed post-installation script returned error exit status 1
  Errors were encountered while processing:
  /var/cache/apt/archives/python-papyon_0.5.5-1ubuntu3.1_all.deb
  E: Sub-process /usr/bin/dpkg returned an error code (1)
  so basically papyon/pydebug or dpkg seems to be causing a problem. I have tried things like
  sudo apt-get -f install
  sudo apt-get --fix-missing install
  following the same problem mentioned in another forum:
  but to no avail. It seems no matter what I do with dpkg I get the same error. I naively tried to this:
  sudo cp /usr/lib/python2.7 /usr/bin/python2.7
  sudo ln -s /usr/bin/python2.7 /usr/bin/python
  but that did not work.
  Any help here would be appriciated.
  This question came from our site for professional and enthusiast programmers.
  Processing was halted because there were too many errors. E: Sub-process /usr/bin/dpkg returned an error code (1)
  That's one hilarious slip of the fingers; I always like to use sudo echo /path/to/files/*glob* to see what files specifically I'm about to delete before I change the echo to rm. Now you've learned the lesson too! Fun.
  sudo echo /path/to/files/*glob*
  echo
  rm
  Preaching aside, this shouldn't be too hard to fix, but it will take a few "passes". deb packages are ar(1) packages, and can be easily manipulated with ar(1):
  deb
  ar(1)
  $ ar xv /var/cache/apt/archives/python-papyon_0.5.5-1ubuntu1.3_all.deb
  x - debian-binary
  x - control.tar.gz
  x - data.tar.gz
  Try this:
  mkdir /tmp/fixing_python
  cd /tmp/fixing_python
  ar xv /var/cache/apt/archives/<package_for_overwriting>
  cd /
  tar zxvf /tmp/fixing_python/data.tar.gz
  Iterate that for every package you need to "fix". debsums(1)'s -c command line option might be helpful, if you've got debsums(1) installed.
  debsums(1)
  -c
  Note that the tar command there is a bit "destructive" -- it'll overwrite whatever it needs to. If you'd rather see what everything will unpack, skip the cd / step beforehand, and tar(1) will unpack into the directory instead, giving you a chance to see what is done.
  tar
  cd /
  tar(1)
  Once you've got everything unpacked that you need, I'd try hard to get dpkg(1) "happy" again through its own mechanisms. (The control.tar.gz contains control scripts that are executed on upgrades, installs, uninstalls, etc. I just had you skip all of them, thinking that once you've got Python re-installed, you can use dkpg(1) itself to fix the problems.)
  dpkg(1)
  control.tar.gz
  dkpg(1)
  We surely have different packages installed, but this might be helpful for you in finding out which packages need fixing:
  $ dpkg -S /usr/bin/python*
  python-minimal: /usr/bin/python
  python2.6-minimal: /usr/bin/python2.6
  python2.7-minimal: /usr/bin/python2.7
  python3-minimal: /usr/bin/python3
  python3.2-minimal: /usr/bin/python3.2
  python3.2-minimal: /usr/bin/python3.2mu
  $
  And note that you can pull down packages directly from the archives without using apt-get(8). They're just HTTP sites and or will make it easy to grab the packages you need with wget(1) or curl(1).
  apt-get(8)
  wget(1)
  curl(1)
  Update
  Oh yes, note that /usr/lib/python* is where the Python libraries and modules are kept. /usr/bin/python* is where the Python interpreter is kept. Your attempt to fix things with cp /usr/lib/python2.7 /usr/bin/python2.7 didn't help. Also /usr/lib/python2.7 is a directory, but /usr/bin/python should be (and was) a single executable file. Feel free to rm -r /usr/bin/python2.7 /usr/bin/python.
  /usr/lib/python*
  /usr/bin/python*
  cp /usr/lib/python2.7 /usr/bin/python2.7
  /usr/lib/python2.7
  /usr/bin/python
  rm -r /usr/bin/python2.7 /usr/bin/python
  -i
  --interactive
  rm -i
  >>> numpy Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'numpy' is not defined
  >>> print sys.path ['', '/usr/local/lib/python27.zip', '/usr/local/lib/python2.7', '/usr/local/lib/python2.7/plat-linux3', '/usr/local/lib/python2.7/lib-tk', '/usr/local/lib/python2.7/lib-old', '/usr/local/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/site-packages']
  numpy
  import numpy
  asked
  4 years ago
  viewed
  2274 times
  active