0

I tend to use a Debian wheezy system, that ships with Python 2.6, 2.7 and 3.2.

However I'm developing now using a local installation Python 3.4 because has a very interesting advantage over Python 3.2.

The problem is that I don't know how to install such a thing as a pdb3.4. When I run pdb3 over my Python 3.4 program, it runs as a Python 3.2 program, failing.

I'm on the need of general Python advice on versions and multi-host (Ubuntu precise and trusty, and Debian wheezy) multi-version development, and I particularly need downloading and building a 3.4 version of pdb, but I don't get to find any documentation on that.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
1737973
  • 159
  • 18
  • 42

1 Answers1

4

Every version of Python comes with its own pdb module. It is part of the standard library.

The version in the 3.4 standard library has no special advantages over the version that comes with 3.2 or 2.7. The last time pdb functionality was changed was in the 3.2 and 2.7 releases (the only thing missing in the 2.6 version is the skip keyword argument to pdb.Pdb(), and 3.3 added more tab completion support).

If you have a pdb command line, then that's just an alias for python3 -m pdb; you can use that with any of your versions:

python3.2 -m pdb yourscript.py

Debian and Ubuntu simply copy the pdb module to /usr/bin/ with the Python version appended, so /usr/lib/python3.2/pdb.py is copied to /usr/bin/pdb3.2.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
  • Actually I have seen that usage written somewhere, but I was confused by not finding any `pdb3.4` binary or script. You answer me, but I'm staring now to /usr/lib/python2.7/pdb.py and /usr/lib/python3.2/pdb.py, the two resolution endpoints of my `pdb` and `pdb3`, and see many more things than just wrapping around a script with '-m pdb '. I wonder other user might need some contents additional to watch you answer me. – 1737973 Jan 19 '15 at 11:52
  • The rest of the module is well enough documented in the Python documentation I linked to. – Martijn Pieters Jan 19 '15 at 12:01
  • The sentence _If you have a `pdb` command line, then that's just an alias for `python3 -m pdb`_ is not true. But maybe it is true in your particular system. – 1737973 Jan 19 '15 at 12:55
  • @galegosimpatico: Debian copies the whole `pdb` library to `/usr/bin/pdb`. Running `python -m pdb` does the *exact same thing* as running the library as a script. Python modules can double up as scripts and can also be used as `-m modulename` on the command line, `pdb` does both. – Martijn Pieters Jan 19 '15 at 13:03
  • @galegosimpatico: The module has a `__main__` test [at the bottom of the file](https://hg.python.org/cpython/file/3.4/Lib/pdb.py#l1682) that handles being run as a script or with `python -m pdb`. If you use `diff -u /usr/bin/pdb3.4 /usr/lib/python3.4/pdb.py` you'll see that the files do not differ. – Martijn Pieters Jan 19 '15 at 13:07