osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

New to Python and understanding problem


Hello *,

because I am runing into problems with SOME python based programs, I the
this as opportunity to learn python (after ASM, C,  BaSH,  CP/M,  COBOL,
JS, PHP and perl).


OK, I tried to install "blueman" (Bluetooth Manager) on  my  Debian  9.2
(Stretch system and discovered a problem:

----[ c 'blueman-applet' ]----------------------------------------------
Traceback (most recent call last):
  File "./blueman-applet", line 15, in <module>
    from blueman.Functions import create_logger, create_parser,
set_proc_title
ImportError: No module named 'blueman'
------------------------------------------------------------------------

So ist does not find the module and this are the fist 16  lines  of  the
python script:

----[ '/usr/bin/blueman-applet' ]---------------------------------------
#!/usr/bin/env python3
# coding=utf-8

import sys
import os
import signal
import logging

# support running uninstalled
_dirname = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
if 'BLUEMAN_SOURCE' in os.environ:
    sys.path = [_dirname, os.path.join(_dirname, 'module', '.libs')] +
sys.path
    os.environ["GSETTINGS_SCHEMA_DIR"] = os.path.join(_dirname, "data")

from blueman.Functions import create_logger, create_parser, set_proc_title
from blueman.main.Applet import BluemanApplet
------------------------------------------------------------------------

I think, that I have found the error here:

sys.path = [_dirname, os.path.join(_dirname, 'module', '.libs')] + sys.path

because there is written in

----[ '/usr/lib/python-3.5/os.py' ]-------------------------------------
To get a full path (which begins with top) to a file or directory in
dirpath, do os.path.join(dirpath, name).
------------------------------------------------------------------------

Hence, os.path.join() has only 2 parameters and not 3.

The module "blueman" is a subdirectory and the full path is

    /usr/lib/python-3.5/site-packages/blueman

So, how can I correct this problem?

And then here is anoter thing which I do not understand becasue I have
not found it in the Tutorial:

What do the [ ... ] mean or what function is it?

Thanks in avance

-- 
Michelle Konzack        Miila ITSystems @ TDnet
GNU/Linux Developer     00372-54541400