On Wed, 01 Feb 2017 21:29:00 +0000, Chris Green wrote: > Wildman <best_...@yahoo.com> wrote: >> On Wed, 01 Feb 2017 19:15:13 +0000, Chris Green wrote: >> >> > Wildman <best_...@yahoo.com> wrote: >> >> On Wed, 01 Feb 2017 17:12:26 +0000, Chris Green wrote: >> >> >> >> > I'm often hitting this problem, how does one find out what package to >> >> > install to provide what a give import needs? >> >> > >> >> > Currently I'm modifying some code which has 'import gtk', I want to >> >> > migrate from Python 2 to Python 3 if I can but at the moment the >> >> > import fails in Python 3. >> >> > >> >> > There are dozens of packages in the Ubuntu repositories which *might* >> >> > provide what I need I don't want to try them all! So, is there an >> >> > easy way to find out? >> >> > >> >> > ... and while I'm here, can someone tell me what package I need? >> >> >> >> Try this: >> >> >> >> import gi >> >> gi.require_version('Gtk', '3.0') >> >> from gi.repository import Gtk >> >> >> > That works but it's a workaround rather than the proper way to do it >> > isn't it? >> >> It is the proper way. This page helps explain it. >> >> http://askubuntu.com/questions/784068/what-is-gi-repository-in-python >> > OK, thank you, what a strange way to do it.
I am sure there is a reason and I believe it has something to do with the fact that GTK3 is a recent addition. Things might change in the future. >> > ... and doesn't it need an internet connection? >> >> No. >> > OK, no problem, but isn't it very non-portable? I don't see why not. It should work on any system that has Python3 installed, at least that is my understanding. I'm sure someone will correct me if I'm wrong. OTOH if you want in insure 100% portability with any script, you can use pyinstaller. To install for Python2: pip install pyinstaller For Python3: pip3 install pyinstaller http://www.pyinstaller.org/ -- <Wildman> GNU/Linux user #557453 The cow died so I don't need your bull! -- https://mail.python.org/mailman/listinfo/python-list