Re: New to Python and understanding problem

2018-02-03 Thread Michelle Konzack
Hello peter and *,

Am 2018-02-03 hackte Peter J. Holzer in die Tasten:
> On 2018-01-29 19:14:57 +0100, Michelle Konzack wrote:
>> Am 2018-01-29 hackte Dan Stromberg in die Tasten:
>> > I don't see blueman on pypi, so this is probably part of the package
>> > you downloaded, and not something you need to "pip3 install".
>>
>> I have Python 2.7 and 3.5 from the Debian GNU/Linux repository installed
>> I use the Stable (Stretch) version.
>>
>> Installing blueman 2.0.4 (for Python 2.7) ended with a SEGFAULT.
>
> How did you install this? When I install blueman-2.0.4-1 from the Debian
> Stretch (i386) apt repository, it uses Python3:
>
> hjp  16620  2.0  0.5 110192 44316 pts/24   Sl+  11:40   0:00
> /usr/bin/python3 /usr/bin/blueman-applet
>
> And it seems to work (the icon shows up in the task bar and I can open
> the menu. I don't have any bluetooth hardware on my desktop, so I can't
> test that).
>
> A segfault is probably caused by a library, not by Python. If you got
> blueman from the Debian repository, report the problem at
> https://bugs.debian.org
>
>> Hence I downloaded the sources 2.1~alpha2 from the Experimantal Mirror,
>> comiled and packed it as Backport.
>>
>> Anything went fine, except, if I execute /usr/bin/blueman-applet it
>> does not find the path to blueman which is in
>>
>> /usr/lib/python-3.5/site-packages
>>
>> as subdirectory "bluman".
>
> This looks like a packaging error. AFAICS python3 packages on Debian are
> normally installed directly under /usr/lib/python3.5, not under
> /usr/lib/python-3.5/site-packages or /usr/lib/python-3.5/dist-packages
> (although the latter is on sys.path). Unless you have modified this
> yourself, please report it to Debian.

I do not know what was in the experimental sources, but it seems a
make clean has removed something and when I recompiled the package,
it was correctly working.

However, I use xorg, fvwm, trayer, blueman-applet like pasystray and
was searchin the whole internet to solv this problem. Had installed
and deinstalled packages and now it is magicaly working.

Now I have to figure out, which of the packages pulled a missing
dependency into the system.

It is sad, that only monsters like KGE (it would install 1,8GByte
on my system) and GNOME have all the right dependencies.

But if you install something like

debian base
alsa
xorg
wdm
fvwm
vlc
trayer
blueman
pasystray

nothing is working!  I think the above packages should install a
working system!

Now I have to figure out, WHY ALSA is working (pasystray show it)
but there is no sound coming out of the speakers.

I say only:  "Welcome to the dependeny hell!"

Thanks in avance

-- 
Michelle KonzackMiila ITSystems @ TDnet
GNU/Linux Developer 00372-54541400

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: New to Python and understanding problem

2018-02-03 Thread Peter J. Holzer
On 2018-01-29 19:14:57 +0100, Michelle Konzack wrote:
> Am 2018-01-29 hackte Dan Stromberg in die Tasten:
> > I don't see blueman on pypi, so this is probably part of the package
> > you downloaded, and not something you need to "pip3 install".
> 
> I have Python 2.7 and 3.5 from the Debian GNU/Linux repository installed
> I use the Stable (Stretch) version.
> 
> Installing blueman 2.0.4 (for Python 2.7) ended with a SEGFAULT.

How did you install this? When I install blueman-2.0.4-1 from the Debian
Stretch (i386) apt repository, it uses Python3:

hjp  16620  2.0  0.5 110192 44316 pts/24   Sl+  11:40   0:00 
/usr/bin/python3 /usr/bin/blueman-applet

And it seems to work (the icon shows up in the task bar and I can open
the menu. I don't have any bluetooth hardware on my desktop, so I can't
test that).

A segfault is probably caused by a library, not by Python. If you got
blueman from the Debian repository, report the problem at
https://bugs.debian.org

> Hence I downloaded the sources 2.1~alpha2 from the Experimantal Mirror,
> comiled and packed it as Backport.
> 
> Anything went fine, except, if I execute /usr/bin/blueman-applet it
> does not find the path to blueman which is in
> 
> /usr/lib/python-3.5/site-packages
> 
> as subdirectory "bluman".

This looks like a packaging error. AFAICS python3 packages on Debian are
normally installed directly under /usr/lib/python3.5, not under
/usr/lib/python-3.5/site-packages or /usr/lib/python-3.5/dist-packages
(although the latter is on sys.path). Unless you have modified this
yourself, please report it to Debian.

hp

-- 
   _  | Peter J. Holzer| we build much bigger, better disasters now
|_|_) || because we have much more sophisticated
| |   | h...@hjp.at | management tools.
__/   | http://www.hjp.at/ | -- Ross Anderson 


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: New to Python and understanding problem

2018-01-29 Thread Michelle Konzack
Good morning,

Am 2018-01-30 hackte careenjosep...@gmail.com in die Tasten:
> One contributing factor to this problem is the artificial environment that
> online courses provide to students. Students are usually typing code into
> a web page that contains instructions and hints. This is not how real
> programming gets done. So when the course is over and it’s time to use a
> real programming environment, students feel lost without the environment
> that they are accustomed to.

I started coding in 1984 with ASM on a 8049 Microcontroller and since
then, I was always looking into other sourcecodes to understand how
something is working.

I have no clue about Python, but I feel very well/comfortable with it. I
think, it is not very complicate to learn, because python is very logic
structured.

This is why I just go the idea of bug-hunting in the blueman app.

Thanks in avance

-- 
Michelle KonzackMiila ITSystems @ TDnet
GNU/Linux Developer 00372-54541400

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: New to Python and understanding problem

2018-01-29 Thread careenjoseph36
One contributing factor to this problem is the artificial environment that 
online courses provide to students. Students are usually typing code into a web 
page that contains instructions and hints. This is not how real programming 
gets done. So when the course is over and it’s time to use a real programming 
environment, students feel lost without the environment that they are 
accustomed to.
https://www.besanttechnologies.com/training-courses/salesforce-training-institute-in-chennai
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: New to Python and understanding problem

2018-01-29 Thread Peter Otten
Michelle Konzack wrote:

> 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 
> 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.

os.path.join() accepts one or more parameters as you can verify in the 
interactive interpreter:

$ python3
Python 3.4.3 (default, Nov 28 2017, 16:41:13) 
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.path.join()
Traceback (most recent call last):
  File "", line 1, in 
TypeError: join() missing 1 required positional argument: 'a'
>>> os.path.join("foo")
'foo'
>>> os.path.join("foo", "bar")
'foo/bar'
>>> os.path.join("foo", "bar", "baz")
'foo/bar/baz'

> 
> 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?

Random idea: Did you set the BLUEMAN_SOURCE environment variable? If so, try 
to unset it. If that doesn't help insert the line

print(sys.path)

into the blueman-applet script right after the line 

import sys

This should print a list of paths that Python searches for modules. Does 
this list contain the 

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

directory? If it doesn't, what's actually in that list? 

> 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?

If it occurs in Python source code it is a list literal

>>> a = [1, 10, 100]
>>> type(a)


or a list comprehension

>>> b = [x*x for x in a]
>>> b
[1, 100, 1]

Both should be mentioned in every Python tutorial.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: New to Python and understanding problem

2018-01-29 Thread Michelle Konzack
Hello Dan,

Am 2018-01-29 hackte Dan Stromberg in die Tasten:
> I don't see blueman on pypi, so this is probably part of the package
> you downloaded, and not something you need to "pip3 install".

I have Python 2.7 and 3.5 from the Debian GNU/Linux repository installed
I use the Stable (Stretch) version.

Installing blueman 2.0.4 (for Python 2.7) ended with a SEGFAULT.
Hence I downloaded the sources 2.1~alpha2 from the Experimantal Mirror,
comiled and packed it as Backport.

Anything went fine, except, if I execute /usr/bin/blueman-applet it
does not find the path to blueman which is in

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

as subdirectory "bluman".  OK, I can hardcode this pig for myself,
but I would prefer to make it the correct way and submit a
bugreport with patch.

> Sometimes this sort of problem surfaces when someone tries to run a
> package with a different python than the python the package is
> installed into.  Do you have more than one python on your machine?

2.7 and 3.5

But since the Python script /usr/bin/blueman-applet has the shebang

#!/usr/bin/env python3

The module path should be ok.


Thanks in avance

-- 
Michelle KonzackMiila ITSystems @ TDnet
GNU/Linux Developer 00372-54541400

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: New to Python and understanding problem

2018-01-29 Thread MRAB

On 2018-01-29 17:01, Michelle Konzack wrote:
[snip]


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.


os.path.join() will accept any number of parameters, except zero.

[snip]
--
https://mail.python.org/mailman/listinfo/python-list


Re: New to Python and understanding problem

2018-01-29 Thread Dan Stromberg
On Mon, Jan 29, 2018 at 9:01 AM, Michelle Konzack
 wrote:
> 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 
> from blueman.Functions import create_logger, create_parser,
> set_proc_title
> ImportError: No module named 'blueman'
> 

I don't see blueman on pypi, so this is probably part of the package
you downloaded, and not something you need to "pip3 install".

Sometimes this sort of problem surfaces when someone tries to run a
package with a different python than the python the package is
installed into.  Do you have more than one python on your machine?
-- 
https://mail.python.org/mailman/listinfo/python-list


New to Python and understanding problem

2018-01-29 Thread Michelle Konzack
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 
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 KonzackMiila ITSystems @ TDnet
GNU/Linux Developer 00372-54541400

-- 
https://mail.python.org/mailman/listinfo/python-list