[TriLUG] OT: beginner python question, what does "import" do
jonc
jonc at nc.rr.com
Thu Aug 4 13:54:53 EDT 2005
A package can contain multiple modules. When the package is loaded into
Python the modules are registered and you can import them into your
local version of Python.
>From a command line in Python try typing:
import this
That's all you need to know...
Jon
On Thu, 2005-08-04 at 10:57, Joseph Mack NA3T wrote:
> I don't know anything about python, but preliminary googling
> in Python tutorials hasn't found the answer.
>
> I have a python program which has
>
> import dbus
> import gtk
>
> and which runs without errors (so I assume it has found
> dbus and gtk). The program install notes say to
> make sure dbus.py is in PYTHONPATH (set to
> "/usr/lib/python2.4;/usr/lib/python2.4/site-packages").
>
> >From this instruction I would assume that the
> "import dbus" call includes the file dbus.py.
>
> However there is no dbus.py/pyc or gtk.py/pyc on the machine.
> There is a _dbus.py and pygtk.py in $PYTHONPATH.
> _dbus.py itself imports dbus, so can't be exporting it.
> pygtk.py doesn't seem to export a label "gtk".
>
> Where is the program importing dbus and gtk from?
>
> Thanks Joe
>
> --
> Joseph Mack NA3T EME(B,D), FM05lw North Carolina
> jmack (at) wm7d (dot) net - azimuthal equidistant map
> generator at http://www.wm7d.net/azproj.shtml
> Homepage http://www.austintek.com/ It's GNU/Linux!
More information about the TriLUG
mailing list