[lttng-dev] Python 3.5 bindings broken for babeltrace 1.4-stable ?

Thibault, Daniel Daniel.Thibault at drdc-rddc.gc.ca
Mon Nov 7 20:15:18 UTC 2016

   I'm having a problem with the babeltrace (1.4.0-stable) Python 3.5 bindings.

   This is similar to Jean Spector's earlier (Sat, 29 Oct 2016 16:55:15 +0300) problem ("[lttng-dev] Babeltrace python bindings documentation is not up-to-date") although substantially different.

   I earlier had babeltrace used successfully from Python 3 (after a small binding tweak (bug 1051), albeit with some weird crashes (bugs 1052 and 1054)), and I'm now trying to run the same script with a refreshed babeltrace build, without success.

CentOS Linux release 7.1.1503 (Core) 3.10.0-229.4.2.el7.x86_64
(LTTng tools is NOT installed)
rh-python35-python-devel (rh-python35-python, -libs, -pip, -setuptools, rh-python35-runtime) installed
$ python --version
Python 2.7.5
$ python3 --version
Python 3.5.1 :: Anaconda 4.0.0 (64-bit)

   If I run the sample code on http://lttng.org/docs/v2.8/#doc-viewing-and-analyzing-your-traces-bt-python ($ python3 /path/to/top5proc.py /path/to/trace/kernel) I get:

Traceback (most recent call last):
  File "/.../top5proc.py", line 70, in <module>
    sys.exit(0 if top5proc() else 1)
  File "/.../top5proc.py", line 13, in top5proc
    col = babeltrace.TraceCollection()
AttributeError: module 'babeltrace' has no attribute 'TraceCollection'

The babeltrace-stable-1.4-09c9a6e package was built and installed successfully (logs available), though I had to add a symbolic link to PyCharm Community Edition 2016.1.3 in ~/anaconda3/lib/python3.5/site-packages called babeltrace and pointing to /usr/local/lib/python3.5/site-packages/babeltrace to get PyCharm to recognize the package.  This is a secondary issue (bug 1076) that has no bearing since the test described above was entirely conducted from the command line.  Still, PyCharm reports the same error (although with a different stack) when running similar code.

The bottom line is that Python 3.5 is not recognizing TraceCollection() as a class constructor.

Since babeltrace 2.0 will keep the same Python bindings (Sat, 29 Oct 2016 17:49:26 -0400, Philippe Proulx: "the Python bindings (this API will remain maintained)"), waiting for its release is not pertinent.

Daniel U. Thibault, M.Sc.²

Informaticien scientifique, CME-PSC, Centre de recherches de Valcartier
Recherche et développement pour la défense Canada / Gouvernement du Canada
daniel.thibault at drdc-rddc.gc.ca / Tél: 418-844-4000x4245 Téléc: 418-844-4538
daniel.thibault at forces.gc.ca / Tél: 418-844-4000x4245 Téléc: 418-844-4538

Computer Scientist, MCCS-SPC, Valcartier Research Centre 
Defence Research and Development Canada / Government of Canada
daniel.thibault at drdc-rddc.gc.ca / Tel: 418-844-4000x4245 Fax: 418-844-4538
daniel.thibault at forces.gc.ca / Tel: 418-844-4000x4245 Fax: 418-844-4538

DRDC is an agency of the Department of National Defence / RDDC est une agence du ministère de la Défense nationale

More information about the lttng-dev mailing list