Re: Installing a python package with pipx

2024-06-02 Thread Richard
If it where an issue with pip or pipx, yes. But as you pointed out
yourself, it's also happening on OpenSuse, so the issue can't be pip or
pipx, but rather either what you are trying to install or your
understanding of it.


Am So., 2. Juni 2024 um 14:20 Uhr schrieb Richmond :

> I am not complaining, I am trying to find out how to get it working. And
> as pip (and pipx) are debian packages I think it is reasonable to
> discuss it on the debian user list.
>
>


Re: Installing a python package with pipx

2024-06-02 Thread Richmond
Richard  writes:

> python3 -m venv venv
> source venv/bin/activate
> pip install musicpy

OK thanks. And apparently to get idle working I do:

python -m idlelib.idle



Re: Installing a python package with pipx

2024-06-02 Thread Richmond
Richard  writes:


> That's how its done. Also, complaining here about something that
> doesn't even work on other distros and thus can't be a Debian
> problem doesn't make that much sense.

I am not complaining, I am trying to find out how to get it working. And
as pip (and pipx) are debian packages I think it is reasonable to
discuss it on the debian user list.



Re: Installing a python package with pipx

2024-06-02 Thread Richard
python3 -m venv venv
source venv/bin/activate
pip install musicpy

That's how its done. Also, complaining here about something that doesn't
even work on other distros and thus can't be a Debian problem doesn't make
that much sense.

Am So., 2. Juni 2024 um 13:50 Uhr schrieb Richmond :

> OK Back on Debian, I removed the one package installed with pipx, which
> was musicpy, then tried to install it with pip, but got this message
> which actually tells me to use pipx. (There is no package python-musicpy).
>
> pip install musicpy
> error: externally-managed-environment
>
> × This environment is externally managed
> ╰─> To install Python packages system-wide, try apt install
> python3-xyz, where xyz is the package you are trying to
> install.
>
> If you wish to install a non-Debian-packaged Python package,
> create a virtual environment using python3 -m venv path/to/venv.
> Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
> sure you have python3-full installed.
>
> If you wish to install a non-Debian packaged Python application,
> it may be easiest to use pipx install xyz, which will manage a
> virtual environment for you. Make sure you have pipx installed.
>
> See /usr/share/doc/python3.11/README.venv for more information.
>
>


Re: Installing a python package with pipx

2024-06-02 Thread Richmond
OK Back on Debian, I removed the one package installed with pipx, which
was musicpy, then tried to install it with pip, but got this message
which actually tells me to use pipx. (There is no package python-musicpy).

pip install musicpy
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.

See /usr/share/doc/python3.11/README.venv for more information.



Re: Installing a python package with pipx

2024-06-02 Thread Richmond
Richard wrote:
>
>
> On Sat, Jun 1, 2024, 23:50 Richmond  > wrote:
>
> Richard mailto:rrosn...@gmail.com>> writes:
>
> > A packages documentation is always your best
> friend: https://pypi.org
> > /project/idle/
> >
>
> Yes it makes it look easy there, but:
>
> import idle
> Traceback (most recent call last):
>   File "", line 1, in 
>   File ".local/pipx/shared/lib/python3.11/site-packages/idle.py",
> line 4, in 
>     from layout import *
> ModuleNotFoundError: No module named 'layout'
>
> That's what I'm talking about. You wildly mix commands together that
> don't go together. And whatever is off with your paths. Things of pipx
> installed packages should be in .local/bin and .local/shared/pipx. At
> least on Debian that's the default. No idea what you did.
>
>
I don't think your assessment is correct, as I have booted opensuse,
where I do not even have pipx installed and have not used it. I did
these commands:

1059  pip install musicpy
 1062  pip install idle

I got the layout error so:

 1065  pip install layout

cured the layout error but then I got a gui error

 1067  pip install gui

There is no such package.

.local/lib/python3.6/site-packages/idle.py", line 26, in 
    gui.mainloop()
NameError: name 'gui' is not defined



Re: Installing a python package with pipx

2024-06-01 Thread Richard
On Sat, Jun 1, 2024, 23:50 Richmond  wrote:

> Richard  writes:
>
> > A packages documentation is always your best friend: https://pypi.org
> > /project/idle/
> >
>
> Yes it makes it look easy there, but:
>
> import idle
> Traceback (most recent call last):
>   File "", line 1, in 
>   File ".local/pipx/shared/lib/python3.11/site-packages/idle.py", line 4,
> in 
> from layout import *
> ModuleNotFoundError: No module named 'layout'
>
That's what I'm talking about. You wildly mix commands together that don't
go together. And whatever is off with your paths. Things of pipx installed
packages should be in .local/bin and .local/shared/pipx. At least on Debian
that's the default. No idea what you did.

>
> > Also, python script isn't a necessarily a standalone executable. And
> > also, you shouldn't just wildly mix pipx commands with pip commands
> > if you don't know what you are doing. Either create a venv with
> > python3 -m venv or use pipx, not both. Once created, stick to these
> > separate paths. And read the documentation of pipx while you're at
> > it. Sure, venvs are easy to handle, as you can just delete them and
> > start from scratch, but mixing commands without knowing what one is
> > doing is just a recipe for desaster.
> >
>
> I don't know what I am doing for sure. But I did not wildly mix, I just
> kept trying things until I found something which worked. Most things
> didn't, and still don't.
>
You are, your last comment is more than proof enough.

You should just remove everything you installed with pipx, create a
separate venv - without using pipx! - and solely work inside it. And don't
touch pipx for anything that's not meant as a standalone CLI  program, like
yt-dlp, speedtest and the sorts. Maybe that way you can't do that much
wrong.

At this point this is hardly a Debian related topic. You should first learn
more about Python venvs and their package managers.

>


Re: Installing a python package with pipx

2024-06-01 Thread Richmond
Richard  writes:

> A packages documentation is always your best friend: https://pypi.org
> /project/idle/
>

Yes it makes it look easy there, but:

import idle
Traceback (most recent call last):
  File "", line 1, in 
  File ".local/pipx/shared/lib/python3.11/site-packages/idle.py", line 4, in 

from layout import *
ModuleNotFoundError: No module named 'layout'



> Also, python script isn't a necessarily a standalone executable. And
> also, you shouldn't just wildly mix pipx commands with pip commands
> if you don't know what you are doing. Either create a venv with
> python3 -m venv or use pipx, not both. Once created, stick to these
> separate paths. And read the documentation of pipx while you're at
> it. Sure, venvs are easy to handle, as you can just delete them and
> start from scratch, but mixing commands without knowing what one is
> doing is just a recipe for desaster.
>

I don't know what I am doing for sure. But I did not wildly mix, I just
kept trying things until I found something which worked. Most things
didn't, and still don't.



Re: Installing a python package with pipx

2024-06-01 Thread Richard
A packages documentation is always your best friend:
https://pypi.org/project/idle/

Also, python script isn't a necessarily a standalone executable. And also,
you shouldn't just wildly mix pipx commands with pip commands if you don't
know what you are doing. Either create a venv with python3 -m venv or use
pipx, not both. Once created, stick to these separate paths. And read the
documentation of pipx while you're at it. Sure, venvs are easy to handle,
as you can just delete them and start from scratch, but mixing commands
without knowing what one is doing is just a recipe for desaster.

On Sat, Jun 1, 2024, 23:00 Richmond  wrote:

> Richard  writes:
>
> > Pretty much just what pipx does.
> >
>
> Well I don't know how.
>
> Now I need to run idle in my new environment. I have installed it
>
> .local/pipx/shared/bin/pip install idle
>
> and it is here:
>
> .local/pipx/shared/lib/python3.11/site-packages/idle.py
>
> but I don't know how to run it. I just get errors.
>
>


Re: Installing a python package with pipx

2024-06-01 Thread Richmond
Richard  writes:

> Pretty much just what pipx does.
>

Well I don't know how.

Now I need to run idle in my new environment. I have installed it

.local/pipx/shared/bin/pip install idle

and it is here:

.local/pipx/shared/lib/python3.11/site-packages/idle.py

but I don't know how to run it. I just get errors.



Re: Installing a python package with pipx

2024-06-01 Thread Richard
Pretty much just what pipx does.

On Sat, Jun 1, 2024, 22:00 Richmond  wrote:

>
> I got it working by doing:
>
> python3 -m venv .local/pipx/venvs/musicpy/
>
> .local/pipx/venvs/musicpy/bin/python3.11
>
> Then I was able to import musicpy from the python shell.
>
> How bewildering!
>
> Thanks.
>
>


Re: Installing a python package with pipx

2024-06-01 Thread Richmond
Richard  writes:

> That's the point of venv's. pipx runpip should do the trick. Or the
> classic way: source path/to/venv/bin/activate. That way you activate
> the position virtual environment (venv) created in that directory
> with all packages installed in that venv.
>

I got it working by doing:

python3 -m venv .local/pipx/venvs/musicpy/

.local/pipx/venvs/musicpy/bin/python3.11

Then I was able to import musicpy from the python shell.

How bewildering!

Thanks.



Re: Installing a python package with pipx

2024-06-01 Thread Richard
That's the point of venv's. pipx runpip should do the trick. Or the classic
way: source path/to/venv/bin/activate. That way you activate the position
virtual environment (venv) created in that directory with all packages
installed in that venv.

Richard

On Sat, Jun 1, 2024, 19:10 Richmond  wrote:

> I guess I have to tell python where to look?
>
>


Re: Installing a python package with pipx

2024-06-01 Thread Richmond
Richard  writes:

> Looking at the package, no wonder it fails. musicpy doesn't contain
> anything that can be executed. So pipx run can't work for obvious
> reasons. You'll have to install it with pipx install and use it in a
> python script.
>
> https://pypi.org/project/musicpy/
>

OK so I have found:

./.local/pipx/venvs/musicpy/lib/python3.11/site-packages/musicpy/musicpy.py

But:

 python3.11
Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import musicpy
Traceback (most recent call last):
  File "", line 1, in 
ModuleNotFoundError: No module named 'musicpy'

I guess I have to tell python where to look?



Re: Installing a python package with pipx

2024-06-01 Thread Richard
Looking at the package, no wonder it fails. musicpy doesn't contain
anything that can be executed. So pipx run can't work for obvious reasons.
You'll have to install it with pipx install and use it in a python script.

https://pypi.org/project/musicpy/

Richard

On Sat, Jun 1, 2024, 18:40 Richmond  wrote:

> Richard  writes:
>
> > If you haven't closed the terminal window/logged out, you need to run
> > source .bashrc. Running pipx ensurepath should have said something
> > like that.
>
> Yes, I did this:
> >
> > (logged out and in to get updated PATH)
>
>


Re: Installing a python package with pipx

2024-06-01 Thread Richmond
Richard  writes:

> If you haven't closed the terminal window/logged out, you need to run
> source .bashrc. Running pipx ensurepath should have said something
> like that.

Yes, I did this:
>
> (logged out and in to get updated PATH)



Re: Installing a python package with pipx

2024-06-01 Thread Richard
If you haven't closed the terminal window/logged out, you need to run
source .bashrc. Running pipx ensurepath should have said something like
that.

Richard

On Sat, Jun 1, 2024, 18:10 Richmond  wrote:

> I have been trying to install this:
>
> https://pypi.org/project/musicpy/#description
>
> with not much success.
>
> I have done these:
>
> sudo aptitude install pip
> sudo aptitude install pipx
> pipx ensurepath
> pipx install --include-deps musicpy
>
> (logged out and in to get updated PATH)
>
>  pipx run musicpy
> 'musicpy' executable script not found in package 'musicpy'.
> Available executable scripts:
>
> I think it is installed, but how do I run it?
>
>


Installing a python package with pipx

2024-06-01 Thread Richmond
I have been trying to install this:

https://pypi.org/project/musicpy/#description

with not much success.

I have done these:

sudo aptitude install pip
sudo aptitude install pipx
pipx ensurepath
pipx install --include-deps musicpy

(logged out and in to get updated PATH)

 pipx run musicpy
'musicpy' executable script not found in package 'musicpy'.
Available executable scripts:

I think it is installed, but how do I run it?



RV: python

2024-03-11 Thread Víctor José Jiménez Asensio
Gracias Fernando.

 

Este mensaje se dirige exclusivamente a su destinatario y puede contener 
información privilegiada o confidencial. Si no es vd. el destinatario indicado, 
queda notificado de que la lectura, utilización, divulgación y/o copia sin 
autorización está prohibida en virtud de la legislación vigente. Si ha recibido 
este mensaje por error, le rogamos que nos lo comunique inmediatamente por esta 
misma vía y proceda a su destrucción.

El correo electrónico vía Internet no permite asegurar la confidencialidad de 
los mensajes que se transmiten ni su integridad o correcta recepción.

 

De: Romero, Fernando [mailto:fernando.rom...@trenesargentinos.gob.ar] 
Enviado el: lunes, 11 de marzo de 2024 16:36
Para: debian-user-spanish@lists.debian.org
Asunto: python

 

Hola como están, no es de debían pero siempre para un sysadmin saber de Python 
nos ayuda mucho.

Les dejo un curso desde cero que lo van subiendo todas las semanas por lo que 
veo siguiendo el canal

 

Saludos

 

https://www.youtube.com/playlist?list=PLu_htiBDhr8GaHkY_IUWpr7wy72kjf5mw

 

“El contenido del presente mensaje (y sus anexos) es privado, confidencial y de 
exclusivo uso para el destinatario referenciado; es de público conocimiento que 
las comunicaciones por medio de Internet no permiten asegurar ni garantizar la 
confidencialidad de los mensajes transmitidos, así como tampoco su integridad o 
su correcta recepción; es por ello que SOFSE no se responsabiliza de posibles 
perjuicios derivados de la captura, incorporaciones de virus o cualquier otra 
manipulación efectuada por terceros. Las opiniones expresadas en este mensaje y 
en los archivos adjuntos son propias del remitente y no representan la opinión 
o políticas de SOFSE, salvo que se diga expresamente y el remitente se 
encuentre autorizado para ello” 



python

2024-03-11 Thread Romero, Fernando
Hola como están, no es de debían pero siempre para un sysadmin saber de Python 
nos ayuda mucho.
Les dejo un curso desde cero que lo van subiendo todas las semanas por lo que 
veo siguiendo el canal

Saludos

https://www.youtube.com/playlist?list=PLu_htiBDhr8GaHkY_IUWpr7wy72kjf5mw

"El contenido del presente mensaje (y sus anexos) es privado, confidencial y de 
exclusivo uso para el destinatario referenciado; es de público conocimiento que 
las comunicaciones por medio de Internet no permiten asegurar ni garantizar la 
confidencialidad de los mensajes transmitidos, así como tampoco su integridad o 
su correcta recepción; es por ello que SOFSE no se responsabiliza de posibles 
perjuicios derivados de la captura, incorporaciones de virus o cualquier otra 
manipulación efectuada por terceros. Las opiniones expresadas en este mensaje y 
en los archivos adjuntos son propias del remitente y no representan la opinión 
o políticas de SOFSE, salvo que se diga expresamente y el remitente se 
encuentre autorizado para ello"


Re: Using a Python script as a login shell

2024-02-16 Thread Alex King
Hey this looks like a fun thing to play with, I like what you've done.  
I logged in and accessed it.  Now that it's been some time since you 
announced it and it's still running, I guess it has had some testing 
already.


I don't see anything wrong with what you have done after a quick look, 
it seems like you took some steps to secure it.


If you care about security you want to think about defense in depth.  
Even if there don't appear to be ways for arbitrary filesystem or 
network access to happen, you have to consider the effect of bugs in 
your program and bugs in python itself.


To protect against unwanted filesystem access, I suggest:

 * use a vm without anything else important on it
 * consider filesystem quotas
 * lock down the user as much as possible.  Consider e.g. apparmor or
   selinux.  Maybe consider containerization/capabilities inside the VM

To protect against unwanted network access:

 * prevent all outgoing network connections from the VM using
   iptables/nftables (or whitelist any that are necessary)
 * again consider networking restrictions using apparmor or selinux.

What level of protection is necessary will depend on the severity of 
impact in the case it gets hacked, and also your own level of 
conscientiousness.


Also consider putting in some monitoring; monitor network bandwith and 
CPU usage at least (perhaps # of logins as well) and set up an alert if 
those go outside limits, so you get timely notification if something 
should happen.


Have fun,
Alex

P.S. this brings to mind 
https://en.wikipedia.org/wiki/Russell_Coker#SELinux_Play_Machine, which 
is no longer operating.


When you say "expose it to the internet via SSH", do you mean expose it 
to everyone (e.g. by publishing the pssword), or will there still be 
some restrictions on who can access it?  If the former, you should be 
able to set up ssh without any password required.


On 16/02/24 21:36, Ralph Aichinger wrote:

Hello fellow Debianites!

I want do do a custom CLI for a project, and I am quite happy with the
Python cmd module. Aside from having a practically un-googleable name
it is very nice, and does a lot with very little code. So far, so good.
But:

If I write a Python script with this module, and expose it to the
internet via SSH, will hell break loose? So far I've done the
following:

1. Put my script in /usr/local/bin/turtle (the canonical example in the
docs is something with turtle), you can see the sourcecode of my script
here:

https://pi.h5.or.at/mockturtle.txt

This script does absolutely nothing sensible, you can try it out
by doing a

ssh -l admin probe.aisg.at

from a IPv6 capable host (sorry, no IPv4). The password is "admin".

Any and all suggestions on stuff that is stupid and crazy from a
security standpoint in this script are very much appreciated!

2. Then I put /usr/local/bin/turtle in /etc/shells

3. I added a user "admin" that has /usr/local/bin/turtle as shell

4. I added following stanza to /etc/ssh/sshd_config

Match User admin
 X11Forwarding no
 AllowTcpForwarding no
 ForceCommand /usr/local/bin/turtle

5. In the script I tried to catch the Ctrl-C signal, so the interpreter
does not give out too obvious error messages (that show what is going
on behind the scenes).

Is this enough to harden this setup against escaping into a shell
or the full python interpreter, to do something nasty? Or is it
completely crazy, because theere is some way to abuse a setup like
this, that I have not found yet?

TIA
Ralph

Using a Python script as a login shell

2024-02-16 Thread Ralph Aichinger
Hello fellow Debianites!

I want do do a custom CLI for a project, and I am quite happy with the
Python cmd module. Aside from having a practically un-googleable name
it is very nice, and does a lot with very little code. So far, so good.
But:

If I write a Python script with this module, and expose it to the
internet via SSH, will hell break loose? So far I've done the
following:

1. Put my script in /usr/local/bin/turtle (the canonical example in the
docs is something with turtle), you can see the sourcecode of my script
here:

https://pi.h5.or.at/mockturtle.txt

This script does absolutely nothing sensible, you can try it out 
by doing a

ssh -l admin probe.aisg.at 

from a IPv6 capable host (sorry, no IPv4). The password is "admin".

Any and all suggestions on stuff that is stupid and crazy from a
security standpoint in this script are very much appreciated!

2. Then I put /usr/local/bin/turtle in /etc/shells 

3. I added a user "admin" that has /usr/local/bin/turtle as shell

4. I added following stanza to /etc/ssh/sshd_config

Match User admin
X11Forwarding no
AllowTcpForwarding no
ForceCommand /usr/local/bin/turtle

5. In the script I tried to catch the Ctrl-C signal, so the interpreter
does not give out too obvious error messages (that show what is going
on behind the scenes).

Is this enough to harden this setup against escaping into a shell 
or the full python interpreter, to do something nasty? Or is it
completely crazy, because theere is some way to abuse a setup like
this, that I have not found yet?

TIA
Ralph



Installation de bibliothèques python

2023-09-28 Thread BERTRAND Joël
Bonjour à tous,

J'essaye d'installer une bibliothèque python (et je me souviens
pourquoi je hais ce truc, mais c'est une autre histoire).

La bibliothèque en question est pcbnewTransition qui a un makefile.
Parfait, je sais créer le paquet :

[~] > make package

Je me retrouve dans ./dist avec ce qu'il faut, à savoir un fichier whl
et un tar.gz. Et c'est là que ça coince.

pip3 install dist/*.whl m'insulte et me demande d'utiliser pipx
install. Très bien, je suis joueur :

hilbert:[~/git/pcbnewTransition] > pipx install dist/*.whl

No apps associated with package pcbnewTransition or its dependencies. If
you are attempting to install a library, pipx should not be used.
Consider using pip or a similar tool instead.

C'est moi ou ça se mord la queue ? Je veux juste installer (juste pour
un utilisateur, même pas pour l'ensemble du système, ça me suffirait)
une bibliothèque que j'ai compilée pour pouvoir installer KiKit par la
suite. Comment faire simplement puisque pip3 me dit que je n'ai pas le
droit de procéder et que pipx me renvoit à pip3 ?

Bien cordialement,

JB



Re: How could a standalone python binary executable be made from a python script, to be run on other computers that don't have python installed?

2023-07-27 Thread Joe
On Thu, 27 Jul 2023 17:46:59 +0530
"Susmita/Rajib"  wrote:

> From: Greg Wooledge 

> > But you REALLY need to go over to python.org and start learning.
> >  
> 
> Yes, Mr. Cater told me. Ref:
> https://lists.debian.org/debian-user/2023/07/msg00637.html
> 
> I have thanked him for that. Have talked about my ignorance of Python
> virtualisation there. Ref:
> https://lists.debian.org/debian-user/2023/07/msg00645.html
> 
> Yes, I now am considering that I might need to. But learning an entire
> system just to address a minor need, can it be called efficient use of
> available resources? I am evaluating.
> 

Have you tried Google? For example:

https://en.wikipedia.org/wiki/Py2exe

https://levelup.gitconnected.com/4-python-standalone-executables-for-a-simpler-app-interaction-d47b6a560919

https://www.mssqltips.com/sqlservertip/7608/python-executable-standalone-application/

Many, many, many people have asked what you have asked. There are
probably more suggestions than these which came near the top of my
quick search. I can't comment on them as I don't do Python myself apart
from an occasional dabble with a Raspberry Pi (Pi for Python) or
Arduino.script.

-- 
Joe



Re: How could a standalone python binary executable be made from apython script, to be run on other computers that don't have pythoninstalled?

2023-07-27 Thread gene heskett

On 7/27/23 03:28, Andrew M.A. Cater wrote:

On Thu, Jul 27, 2023 at 07:08:35AM +0530, Susmita/Rajib wrote:

 From: David Wright 
 Date: Wed, 26 Jul 2023 12:22:04 -0500
 Message-id: <[] zmfwpfrxuvr5g...@axis.corp>
 Reply-to: debian-user@lists.debian.org
 In-reply-to: <[]
CAEG4cZXy=0lra4adonsaueeoafdyapoqf5cze3s1zerrjfs...@mail.gmail.com>
 References: <[]
CAEG4cZXe=BUQ5VE_z0rcLqHGGERdANnZ=vjiznjbk439jif...@mail.gmail.com>


<[] CAEG4cZXy=0lra4adonsaueeoafdyapoqf5cze3s1zerrjfs...@mail.gmail.com>


On Mon 24 Jul 2023 at 15:52:38 (+0530), Susmita/Rajib wrote:

 From: David Wright 
 Date: Thu, 20 Jul 2023 10:06:43 -0500


I'm not sure who you think the first and second parties are.

[   ...   ]

I have considered myself as the 1st party. Debian universe as the 2nd
party and the rest as the 3rd party. So by my consideration, anything
'Python' outside of the Debian Universe is 3rd party. I have rarely
install software outside of the Debian Universe.



You are trying to create a stand alone Python script on Debian that
you can give to someone running Windows.

Python is an interpreted language - so that person will need a version
of Python on their machine to run your script. Python versions exist
for Windows but it will need to be installed there.



[   ...   ]

I could have risked if a Debian system snapshot could be
saved and in case of any trouble, could be reverted back to.

Yes, a virtual environment (i.e., virtualisation) however is an idea
that could theoretically be looked into, but that would mean extra
system resources to be spent for it.




This is where terminology is not helpful. Python has the concept of
a virtual environment (venv) in which to run Python programs separately
from the Python installed as the system version - a very simple sandbox,
I think.

And there can be several of the venv's because they can be named, at 
least I have done that on arm64 stuff to indpendently drive 2 3d 
printers at the same time from one bananapi-m5. It works but does 
stretch the bpi a bit.



I don't program in Python so I can't help much further but that's very
different from a full virtualised environment of a Linux machine - kvm / qemu
or similar - which is very different and mor resource hungry.


AIUI a standalone binary is bound to use more resources anyway,
because it duplicates some already supplied as part of the OS.

[   ...   ]



A "standalone binary" in Python is a script relying on the interpreter
just as a script might rely on shell interpreter in Debian.


A virtualisation environment is huge in terms of memory, RAM, HDD or
CPU usages. But let us not discuss on this aspect presently. I want to
build a standalone binaries and give it to a kid who runs Doze. He
doesn't have 'python' environment installed. I am trying to assist
him.

[   ...   ]


¹ As you later wrote: "something published as the Debian Wiki, Release
   Notes, Debian GNU/Linux FAQ or other informative posts or webpages
   that could help disseminate information about issues that matter."

[   ...   ]



With very good wish, as ever,

Andy Cater

.


Cheers, Gene Heskett.
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis
Genes Web page <http://geneslinuxbox.net:6309/>



Re: How could a standalone python binary executable be made from a python script, to be run on other computers that don't have python installed?

2023-07-27 Thread Susmita/Rajib
From: Greg Wooledge 
Date: Thu, 27 Jul 2023 07:02:17 -0400
Message-id: <[] zmjoucnj8uopw...@wooledge.org>
Mail-followup-to: debian-user@lists.debian.org
In-reply-to: <[]
CAEG4cZV77VDaH+LEUA2tYv8LdnQvwXWe1J=zkw7c5p1s9ew...@mail.gmail.com>
References: <[]
CAEG4cZXe=BUQ5VE_z0rcLqHGGERdANnZ=vjiznjbk439jif...@mail.gmail.com>
and the rest

[   ...   ]

> Python makes extremely heavy and common use of "virtual environments".
> This is not full-blown system virtualization as you might be thinking.
> It's more like a chroot, except even lighter.  Really, it's just a
> directory containing a file that sets certain environment variables
> when dotted in.  I'm sure your computer can handle it.
>
> But you REALLY need to go over to python.org and start learning.
>

Yes, Mr. Cater told me. Ref:
https://lists.debian.org/debian-user/2023/07/msg00637.html

I have thanked him for that. Have talked about my ignorance of Python
virtualisation there. Ref:
https://lists.debian.org/debian-user/2023/07/msg00645.html

Yes, I now am considering that I might need to. But learning an entire
system just to address a minor need, can it be called efficient use of
available resources? I am evaluating.

Apologise for the poor sentence construction to my reply to you: "...
so that irrespective of the virtual environment resides or is removed
...", missing a Whether. That is, "... irrespective of whether the
..."

Thank you for your email, Mr. Wooledge.

Best wishes,
Rajib



Re: How could a standalone python binary executable be made from a python script, to be run on other computers that don't have python installed?

2023-07-27 Thread Susmita/Rajib
From: "Andrew M.A. Cater" 
Date: Thu, 27 Jul 2023 07:28:25 +
Message-id: 
In-reply-to: <[]
CAEG4cZXBJ3CbFUN1LuRQsKR=xjkzuw92lxlnrxwkxae-ery...@mail.gmail.com>
References: <[]
CAEG4cZXe=BUQ5VE_z0rcLqHGGERdANnZ=vjiznjbk439jif...@mail.gmail.com>
and the rest
[   ...   ]


Dear Mr. Cater,

I thank you for writing a few lines to express your empathy.

I understand everyone's limitations as well as mine. Hopefully, I will
try to solve the issue or bypass it.


[   ...   ]
>> >> Yes, a virtual environment (i.e., virtualisation) however is an idea
>> >> that could theoretically be looked into, but that would mean extra
>> >> system resources to be spent for it.
>> >
>
> This is where terminology is not helpful. Python has the concept of
> a virtual environment (venv) in which to run Python programs separately
> from the Python installed as the system version - a very simple sandbox,
> I think.
>
> I don't program in Python so I can't help much further but that's very
> different from a full virtualised environment of a Linux machine - kvm /
> qemu
> or similar - which is very different and mor resource hungry.
>
[   ...   ]


Thank you Mr. Cater, especially for the above lines. You helped me
understand that there are two virtualisation environments available,
one being the entire virtualised Hardware environment via QEMU,
VMware, VirtualBox, et al, and the other being only the Python virtual
environment.

I hope my senior list members will educate some more on this aspect.

Best wishes,
Rajib



Re: How could a standalone python binary executable be made from a python script, to be run on other computers that don't have python installed?

2023-07-27 Thread Greg Wooledge
On Thu, Jul 27, 2023 at 08:57:26AM +0530, Susmita/Rajib wrote:
> Is there something called a bare minimum virtualisation, where only
> the python environment could be in a 'cage', isolated from the rest
> system, so that irrespective of the virtual environment resides or is
> removed the system remains in its pristine state?

Python makes extremely heavy and common use of "virtual environments".
This is not full-blown system virtualization as you might be thinking.
It's more like a chroot, except even lighter.  Really, it's just a
directory containing a file that sets certain environment variables
when dotted in.  I'm sure your computer can handle it.

But you REALLY need to go over to python.org and start learning.



Re: How could a standalone python binary executable be made from a python script, to be run on other computers that don't have python installed?

2023-07-27 Thread Greg Wooledge
On Thu, Jul 27, 2023 at 07:28:25AM +, Andrew M.A. Cater wrote:
> You are trying to create a stand alone Python script on Debian that 
> you can give to someone running Windows.
> 
> Python is an interpreted language - so that person will need a version
> of Python on their machine to run your script. Python versions exist
> for Windows but it will need to be installed there.

Rather than saying "this is not possible", I'll simply say "I don't
know whether this is possible".

Tcl has a concept called a "starkit", where StAR is an acronym for
"Stand-Alone Runtime".  It's a toolset for producing single-file
Tcl applications that contain a Tcl interpreter, a Tcl script, and
any necessary packages, all bundled together into a single file for
distribution.  Kinda like a flatpak, but much older and more specialized.

I don't know whether Python has anything analogous.

You know who *would* know, though?  Python developers.  On a Python
mailing list.

Insisting on obtaining this knowledge exclusively through *Debian*
resources is a mental impediment that's closing off any paths to a
solution.



Re: How could a standalone python binary executable be made from a python script, to be run on other computers that don't have python installed?

2023-07-27 Thread Andrew M.A. Cater
On Thu, Jul 27, 2023 at 07:08:35AM +0530, Susmita/Rajib wrote:
> From: David Wright 
> Date: Wed, 26 Jul 2023 12:22:04 -0500
> Message-id: <[] zmfwpfrxuvr5g...@axis.corp>
> Reply-to: debian-user@lists.debian.org
> In-reply-to: <[]
> CAEG4cZXy=0lra4adonsaueeoafdyapoqf5cze3s1zerrjfs...@mail.gmail.com>
> References: <[]
> CAEG4cZXe=BUQ5VE_z0rcLqHGGERdANnZ=vjiznjbk439jif...@mail.gmail.com>
> 
> 
> <[] CAEG4cZXy=0lra4adonsaueeoafdyapoqf5cze3s1zerrjfs...@mail.gmail.com>
> 
> > On Mon 24 Jul 2023 at 15:52:38 (+0530), Susmita/Rajib wrote:
> >> From: David Wright 
> >> Date: Thu, 20 Jul 2023 10:06:43 -0500
> >>
> > I'm not sure who you think the first and second parties are.
> [   ...   ]
> 
> I have considered myself as the 1st party. Debian universe as the 2nd
> party and the rest as the 3rd party. So by my consideration, anything
> 'Python' outside of the Debian Universe is 3rd party. I have rarely
> install software outside of the Debian Universe.
> 

You are trying to create a stand alone Python script on Debian that 
you can give to someone running Windows.

Python is an interpreted language - so that person will need a version
of Python on their machine to run your script. Python versions exist
for Windows but it will need to be installed there.

> 
> [   ...   ]
> >> I could have risked if a Debian system snapshot could be
> >> saved and in case of any trouble, could be reverted back to.
> >>
> >> Yes, a virtual environment (i.e., virtualisation) however is an idea
> >> that could theoretically be looked into, but that would mean extra
> >> system resources to be spent for it.
> >

This is where terminology is not helpful. Python has the concept of
a virtual environment (venv) in which to run Python programs separately
from the Python installed as the system version - a very simple sandbox,
I think.

I don't program in Python so I can't help much further but that's very
different from a full virtualised environment of a Linux machine - kvm / qemu
or similar - which is very different and mor resource hungry.

> > AIUI a standalone binary is bound to use more resources anyway,
> > because it duplicates some already supplied as part of the OS.
> [   ...   ]
> 

A "standalone binary" in Python is a script relying on the interpreter
just as a script might rely on shell interpreter in Debian.

> A virtualisation environment is huge in terms of memory, RAM, HDD or
> CPU usages. But let us not discuss on this aspect presently. I want to
> build a standalone binaries and give it to a kid who runs Doze. He
> doesn't have 'python' environment installed. I am trying to assist
> him.
> 
> [   ...   ]
> >
> > ¹ As you later wrote: "something published as the Debian Wiki, Release
> >   Notes, Debian GNU/Linux FAQ or other informative posts or webpages
> >   that could help disseminate information about issues that matter."
> [   ...   ]
>

With very good wish, as ever,

Andy Cater 



Re: How could a standalone python binary executable be made from a python script, to be run on other computers that don't have python installed?

2023-07-26 Thread Susmita/Rajib
From: Greg Wooledge 
Date: Wed, 26 Jul 2023 22:14:01 -0400
Message-id: <[] zmhs6ajl2jzoi...@wooledge.org>
Mail-followup-to: debian-user@lists.debian.org
In-reply-to: <[]
CAEG4cZXBJ3CbFUN1LuRQsKR=xjkzuw92lxlnrxwkxae-ery...@mail.gmail.com>
References: <[]
CAEG4cZXe=BUQ5VE_z0rcLqHGGERdANnZ=vjiznjbk439jif...@mail.gmail.com>
and others

> On Thu, Jul 27, 2023 at 07:08:35AM +0530, Susmita/Rajib wrote:
>> I have considered myself as the 1st party. Debian universe as the 2nd
>> party and the rest as the 3rd party. So by my consideration, anything
>> 'Python' outside of the Debian Universe is 3rd party. I have rarely
>> install software outside of the Debian Universe.
>
> For Python development questions such as yours, you've got things
> upside down.

[   ...   ]

> Users on this mailing list are a wildcard.  Most people do not possess
> the detailed Python knowledge that you're requesting.  But if someone
> here happens to know Python development extremely well, they might have
> an answer for you.  This includes any pages on the Debian wiki, WHICH
> IS WRITTEN BY END USERS, not by the Debian project.

I totally am in full agreement with what you say, Mr. Wooledge.

But I am unsure whether will my poor system be able to cope with virtualisation.

Is there something called a bare minimum virtualisation, where only
the python environment could be in a 'cage', isolated from the rest
system, so that irrespective of the virtual environment resides or is
removed the system remains in its pristine state?

I have considered creating a new 'user' and installing various python
packages there. But that doesn't happen. There are components that
install with 'root-level' privileges. They can't be removed by just
removing the 'user'.

I have HDD space for a new installation. But a fresh installation takes time.

Two decades back, in 2003, I had bought a software called Acronis OS
selector. It was Version 6, probably. It could duplicate an
installation in just minutes and I could boot from that duplicate OS
with a separate boot menu it also created. Or keep the copied system
as a snapshot/backup. From the feel I could clearly make out that it
was based on Unix(or Linux)-type OS.

Whole partitions could be moved, resized, manipulated, ..., almost
anything one could imagine!

I am unsure if Debian has something like that. Would have solved these problems.



Re: How could a standalone python binary executable be made from a python script, to be run on other computers that don't have python installed?

2023-07-26 Thread David Wright
On Thu 27 Jul 2023 at 07:08:35 (+0530), Susmita/Rajib wrote:
> From: David Wright 
> Date: Wed, 26 Jul 2023 12:22:04 -0500
> > On Mon 24 Jul 2023 at 15:52:38 (+0530), Susmita/Rajib wrote:
> >> Thank you for writing back with the link leading to the Python
> >> Discourse thread. [ … ]
> >> Can't accept a third party website info on face value.
> >
> > PEPs are official Python documents; the one I referred to
> > is an Accepted (as of June last year) Standards Track.
> >
> >> I would have preferred a similar post assuring us
> >> from the Debian Side. A 3rd party software installer from within the
> >> native Debian
> >> system for which there isn't an explicit assurance from Debian is
> >> unsettling.
> >
> > I'm not sure who you think the first and second parties are.
> [   ...   ]
> 
> I have considered myself as the 1st party. Debian universe as the 2nd
> party and the rest as the 3rd party. So by my consideration, anything
> 'Python' outside of the Debian Universe is 3rd party. I have rarely
> install software outside of the Debian Universe.

As one of the two parties, what is it that you're offering? And from
where in the "Debian Universe" are you expecting something in return?
(A universe can hardly be said to be a party to anything.)

Cheers,
David.



Re: How could a standalone python binary executable be made from a python script, to be run on other computers that don't have python installed?

2023-07-26 Thread Greg Wooledge
On Thu, Jul 27, 2023 at 07:08:35AM +0530, Susmita/Rajib wrote:
> I have considered myself as the 1st party. Debian universe as the 2nd
> party and the rest as the 3rd party. So by my consideration, anything
> 'Python' outside of the Debian Universe is 3rd party. I have rarely
> install software outside of the Debian Universe.

For Python development questions such as yours, you've got things
upside down.

The upstream Python developers are the primary source of knowledge.
This includes most web sites in the python.org domain.  If what you
want to achieve is documented by the Python developers on python.org
then you're all set.

The Python community, including Python mailing lists, IRC channels, web
forums and so on, would be your secondary source.  Other Python users
might have done what you're trying to do.  Those people would most likely
be found in the Python community, rather than here.

The Debian Python maintainer(s) might be a tertiary source at best.
This includes official Debian publications such as Release Notes.
However, your question is so incredibly specific and esoteric that it's
not likely to be covered by any such documents.  It never comes up during
a Debian installation or upgrade, because it's a product developer's
question, not a system administrator's question.

Users on this mailing list are a wildcard.  Most people do not possess
the detailed Python knowledge that you're requesting.  But if someone
here happens to know Python development extremely well, they might have
an answer for you.  This includes any pages on the Debian wiki, WHICH
IS WRITTEN BY END USERS, not by the Debian project.



Re: How could a standalone python binary executable be made from a python script, to be run on other computers that don't have python installed?

2023-07-26 Thread Susmita/Rajib
From: David Wright 
Date: Wed, 26 Jul 2023 12:22:04 -0500
Message-id: <[] zmfwpfrxuvr5g...@axis.corp>
Reply-to: debian-user@lists.debian.org
In-reply-to: <[]
CAEG4cZXy=0lra4adonsaueeoafdyapoqf5cze3s1zerrjfs...@mail.gmail.com>
References: <[]
CAEG4cZXe=BUQ5VE_z0rcLqHGGERdANnZ=vjiznjbk439jif...@mail.gmail.com>


<[] CAEG4cZXy=0lra4adonsaueeoafdyapoqf5cze3s1zerrjfs...@mail.gmail.com>

> On Mon 24 Jul 2023 at 15:52:38 (+0530), Susmita/Rajib wrote:
>> From: David Wright 
>> Date: Thu, 20 Jul 2023 10:06:43 -0500
>>
>> Thank you for writing back with the link leading to the Python
>> Discourse thread. [ … ]
>> Can't accept a third party website info on face value.
>
> PEPs are official Python documents; the one I referred to
> is an Accepted (as of June last year) Standards Track.
>
>> I would have preferred a similar post assuring us
>> from the Debian Side. A 3rd party software installer from within the
>> native Debian
>> system for which there isn't an explicit assurance from Debian is
>> unsettling.
>
> I'm not sure who you think the first and second parties are.
[   ...   ]

I have considered myself as the 1st party. Debian universe as the 2nd
party and the rest as the 3rd party. So by my consideration, anything
'Python' outside of the Debian Universe is 3rd party. I have rarely
install software outside of the Debian Universe.

[   ...   ]
> Debian is a distribution, not a software company. The best
> you can expect from Debian is what I gave you: the Release
> Notes for bookworm.¹ Debian offers no guarantees, and you're
> reminded of this every time you login:
>
>  "Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY,
>   to the extent permitted by applicable law."
[   ...   ]

Yes, I have acknowledged and thanked you for your post. But we are not
travelling in that direction presently.

[   ...   ]
>> I could have risked if a Debian system snapshot could be
>> saved and in case of any trouble, could be reverted back to.
>>
>> Yes, a virtual environment (i.e., virtualisation) however is an idea
>> that could theoretically be looked into, but that would mean extra
>> system resources to be spent for it.
>
> AIUI a standalone binary is bound to use more resources anyway,
> because it duplicates some already supplied as part of the OS.
[   ...   ]

A virtualisation environment is huge in terms of memory, RAM, HDD or
CPU usages. But let us not discuss on this aspect presently. I want to
build a standalone binaries and give it to a kid who runs Doze. He
doesn't have 'python' environment installed. I am trying to assist
him.

[   ...   ]
>
> ¹ As you later wrote: "something published as the Debian Wiki, Release
>   Notes, Debian GNU/Linux FAQ or other informative posts or webpages
>   that could help disseminate information about issues that matter."
[   ...   ]



Re: How could a standalone python binary executable be made from a python script, to be run on other computers that don't have python installed?

2023-07-26 Thread David Wright
On Mon 24 Jul 2023 at 15:52:38 (+0530), Susmita/Rajib wrote:
> From: David Wright 
> Date: Thu, 20 Jul 2023 10:06:43 -0500
> 
> Thank you for writing back with the link leading to the Python
> Discourse thread. [ … ]
> Can't accept a third party website info on face value.

PEPs are official Python documents; the one I referred to
is an Accepted (as of June last year) Standards Track.

> I would have preferred a similar post assuring us
> from the Debian Side. A 3rd party software installer from within the native 
> Debian
> system for which there isn't an explicit assurance from Debian is
> unsettling.

I'm not sure who you think the first and second parties are.
Debian is a distribution, not a software company. The best
you can expect from Debian is what I gave you: the Release
Notes for bookworm.¹ Debian offers no guarantees, and you're
reminded of this every time you login:

 "Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY,
  to the extent permitted by applicable law."

> I could have risked if a Debian system snapshot could be
> saved and in case of any trouble, could be reverted back to.
> 
> Yes, a virtual environment (i.e., virtualisation) however is an idea
> that could theoretically be looked into, but that would mean extra
> system resources to be spent for it.

AIUI a standalone binary is bound to use more resources anyway,
because it duplicates some already supplied as part of the OS.

¹ As you later wrote: "something published as the Debian Wiki, Release
  Notes, Debian GNU/Linux FAQ or other informative posts or webpages
  that could help disseminate information about issues that matter."

Cheers,
David.



Re: How could a standalone python binary executable be made from a python script, to be run on other computers that don't have python installed?

2023-07-24 Thread Andy Smith
Hello,

On Mon, Jul 24, 2023 at 05:27:28PM +0530, Susmita/Rajib wrote:
> My first post of this thread is illustrative.

You did indeed state that you only wanted guidance from "Illustrious
leaders and senior List Maintainers of Debian Users ML" so I don't
know why anyone is bothering to give you any of this apparently
unwanted information. Now that you've reiterated your requirements,
perhaps they'll believe you. I don't think that anyone who has so
far responded to you meets your requirements, so it seems like you
will be waiting a long time for any of the information to be
corroborated by a source you trust.

Your wait is going to be so long because you are Doing Debian Wrong.
Perhaps you need a support contract with some entity that you can
pay to give you answers you trust. Then again, as I am not an
illustrious leader nor a senior list member, I can not expect you to
believe me on that, either. Oh well.

Thanks,
Andy

-- 
https://bitfolk.com/ -- No-nonsense VPS hosting



Re: How could a standalone python binary executable be made from a python script, to be run on other computers that don't have python installed?

2023-07-24 Thread Susmita/Rajib
From: Greg Wooledge 
Date: Mon, 24 Jul 2023 07:08:33 -0400
Message-id: <[] zl5bsa9pgfixz...@wooledge.org>
Mail-followup-to: debian-user@lists.debian.org
In-reply-to: <[]
CAEG4cZXy=0lra4adonsaueeoafdyapoqf5cze3s1zerrjfs...@mail.gmail.com>
References: <[]
CAEG4cZXe=BUQ5VE_z0rcLqHGGERdANnZ=vjiznjbk439jif...@mail.gmail.com>


<[] CAEG4cZXy=0lra4adonsaueeoafdyapoqf5cze3s1zerrjfs...@mail.gmail.com>

On Mon, Jul 24, 2023 at 03:52:38PM +0530, Susmita/Rajib wrote:
> Thank you for writing back with the link leading to the Python
> Discourse thread. I would have preferred a similar post assuring us
> from the Debian Side. Can't accept a third party website info on face
> value.

You're talking to the debian-user mailing list.  We're all users
of Debian, and everything we tell you is "third party".
[   ...]

Which is why I said, ",.. I would have preferred a similar post assuring us
 from the Debian Side ..."

I didn't consider Mr. Wright or any of the posts from senior and
experienced List members such as you (I apologise for the typo in my
first post on the present thread, I meant members, not maintainers, it
was an inadvertent typo) when I said "a similar post".

What I meant was, something published as the Debian Wiki, Release
Notes, Debian GNU/Linux FAQ or other informative posts or webpages
that could help disseminate information about issues that matter. My
first post of this thread is illustrative.

I would prefer to wait until Debian includes other additional python
packages. A little supervision, information and guidance is what I
prefer, through the integrity and robustness of apt, the package
repository system and the information dissemination backbone.

Best wishes,
RKB



Re: How could a standalone python binary executable be made from a python script, to be run on other computers that don't have python installed?

2023-07-24 Thread Greg Wooledge
On Mon, Jul 24, 2023 at 03:52:38PM +0530, Susmita/Rajib wrote:
> Thank you for writing back with the link leading to the Python
> Discourse thread. I would have preferred a similar post assuring us
> from the Debian Side. Can't accept a third party website info on face
> value.

You're talking to the debian-user mailing list.  We're all users
of Debian, and everything we tell you is "third party".  Nothing we
say should be taken as authoritative.

You may occasionally see someone posting here with an @debian.org
email address, and those people are members of Debian.  But even then,
whatever they say here is not the Official Word Of Debian.  It's just
their own personal insight or opinion.

So, welcome to Debian, and I hope you find what you're looking for, but
if what you're looking for is The Reassurance Of Authority, you will
not find it here.

As far as building "Python starkits" (if that's the right term) goes,
a Python mailing list would probably be a better source of information
than this one.



Re: How could a standalone python binary executable be made from a python script, to be run on other computers that don't have python installed?

2023-07-24 Thread Susmita/Rajib
From: David Wright 
Date: Thu, 20 Jul 2023 10:06:43 -0500
Message-id: <[] zllngwpvlwjpg...@axis.corp>
Reply-to: debian-user@lists.debian.org
In-reply-to: <[]
CAEG4cZXe=BUQ5VE_z0rcLqHGGERdANnZ=vjiznjbk439jif...@mail.gmail.com>
References: <[]
CAEG4cZXe=BUQ5VE_z0rcLqHGGERdANnZ=vjiznjbk439jif...@mail.gmail.com>

On Thu 20 Jul 2023 at 16:36:44 (+0530), Susmita/Rajib wrote:
[...]

You should probably read this as background:

  https://peps.python.org/pep-0668/

> [...]
> to, presently.

When you do, pipx awaits:

  
https://www.debian.org/releases/stable/amd64/release-notes/ch-information.en.html#python3-pep-668
[...]


Dear Mr. Wright,

Thank you for writing back with the link leading to the Python
Discourse thread. I would have preferred a similar post assuring us
from the Debian Side. Can't accept a third party website info on face
value. A 3rd party software installer from within the native Debian
system for which there isn't an explicit assurance from Debian is
unsettling. I could have risked if a Debian system snapshot could be
saved and in case of any trouble, could be reverted back to.

Yes, a virtual environment (i.e., virtualisation) however is an idea
that could theoretically be looked into, but that would mean extra
system resources to be spent for it.

Then it appears that I will be compelled to wait until my next upgrade.

Thank you for writing back with the relevant information.

Best wishes,
RKB



Re: How could a standalone python binary executable be made from a python script, to be run on other computers that don't have python installed?

2023-07-20 Thread David Wright
On Thu 20 Jul 2023 at 16:36:44 (+0530), Susmita/Rajib wrote:
> I want to have other users run my python script on their computers,
> that don't have python installer, as a standalone binary/executable.
> 
> I searched the debian-user ML with the string, "standalone python
> binary executable" but wasn't able to find a suitable solution.
> 
> Debian repository doesn't appear to have a package called
> `pyinstaller` to make a standalone executable file to be run on Linux
> or doze systems that do not have python installed.
> 
> I found that python3-pip could be used to download pyinstaller.
> 
> But I am diffident of a separate python installer program `pip` of
> which I know nothing, unlike apt and debian repository which are a
> very robust framework.

You should probably read this as background:

  https://peps.python.org/pep-0668/

> The version of python installed in my system is
> Python 3.9.2 (default, Feb 28 2021, 17:03:44)
> [GCC 10.2.1 20210110] on linux

So, bullseye.

> Please reconsider before advising me to update `python3` to its latest
> version which would mean updating my Debian to the latest stable
> repository. I will definitely upgrade Debian in future, but not able
> to, presently.

When you do, pipx awaits:

  
https://www.debian.org/releases/stable/amd64/release-notes/ch-information.en.html#python3-pep-668

Cheers,
David.



Re: How could a standalone python binary executable be made from a python script, to be run on other computers that don't have python installed?

2023-07-20 Thread Roger Price

On Thu, 20 Jul 2023, Susmita/Rajib wrote:


I want to have other users run my python script on their computers,
that don't have python installer, as a standalone binary/executable.


This is the wrong list.  It's a 12 year old question.  A Google search would 
have given you 
https://stackoverflow.com/questions/5458048/how-can-i-make-a-python-script-standalone-executable-to-run-without-any-dependen


Roger



Re: How could a standalone python binary executable be made from a python script, to be run on other computers that don't have python installed?

2023-07-20 Thread Andy Smith
Hi,

On Thu, Jul 20, 2023 at 04:36:44PM +0530, Susmita/Rajib wrote:
> My dear Illustrious leaders and senior List Maintainers of Debian Users ML,

Is there some reason that you only want answers from "leaders" and
"senior List Maintainers" as opposed to the vast majority of list
subscribers, like you and I?

Why even send email to all of us if you only want to address list
maintainers? Their address is listmas...@lists.debian.org, but they
don't answer general user support queries. Not even the "senior"
ones.

Thanks,
Andy

-- 
https://bitfolk.com/ -- No-nonsense VPS hosting



How could a standalone python binary executable be made from a python script, to be run on other computers that don't have python installed?

2023-07-20 Thread Susmita/Rajib
My dear Illustrious leaders and senior List Maintainers of Debian Users ML,

I want to have other users run my python script on their computers,
that don't have python installer, as a standalone binary/executable.

I searched the debian-user ML with the string, "standalone python
binary executable" but wasn't able to find a suitable solution.

Debian repository doesn't appear to have a package called
`pyinstaller` to make a standalone executable file to be run on Linux
or doze systems that do not have python installed.

I found that python3-pip could be used to download pyinstaller.

But I am diffident of a separate python installer program `pip` of
which I know nothing, unlike apt and debian repository which are a
very robust framework.

The version of python installed in my system is
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux

Please reconsider before advising me to update `python3` to its latest
version which would mean updating my Debian to the latest stable
repository. I will definitely upgrade Debian in future, but not able
to, presently.

Eager for your advice.

With best wishes,
Rajib B
Etc.



Re: Follow recent stable Python versions

2023-06-23 Thread Yoann LE BARS



Hello, everybody out there!

Thank you for your answers. I realize I have not made myself clear, my 
bad.

	Indeed, I do not want to change the Python version of the whole 
distribution: I do not want to mess up the system. My need is to follow 
the up-to-date Python stable version for my own developments—and yes, I 
should, and already do, use virtual environments for my own developments.


	So, in fact, my question was: what is the best practice to install a 
specific version of Python alongside the version of the system without 
messing up the system. I would rather use a solution as automatic as 
possible.


	Reading your answers, it turns out that pinning is not a solution. 
Understood.


	There is the option to compile the new version from source, but this is 
really not automatic, and my experience is that you easily make mistakes 
when you repeatedly do the same task. I would rather not use that option.


	Pyenv seems to be a tool made for what I need to do. The thing is, as 
far as I know, there is no package in the distribution for it. Though, 
the procedure to install it is well described 
(https://realpython.com/intro-to-pyenv/), and there is a pyenv-update 
plgugin to keep it up to date—well, I prefer using the package manager, 
but anyway.


	There is an official Docker image for Python 
(https://hub.docker.com/_/python/), but Pyenv seems to be more fitted to 
manage a specific virtual environment for each project.


What does experience Python developers on Debian recommend?

Best regards.

--
Yoann LE BARS
https://le-bars.net/yoann/



Re: Follow recent stable Python versions

2023-06-22 Thread Anssi Saari
Dan Ritter  writes:

> You will want to let the Debian python packages alone, and
> install new pythons from source in /opt/python-VER or such. Then
> use venvs to make sure that you are always getting the python
> you really want.

There's a tool called pyenv which handles downloads, compilations and
venvs neatly.



Re: Follow recent stable Python versions

2023-06-22 Thread Celejar
On Thu, 22 Jun 2023 19:34:54 -0400
Greg Wooledge  wrote:

> On Fri, Jun 23, 2023 at 01:06:05AM +0200, Yoann LE BARS wrote:
> > As far as I know, Python is not part of backports. Is there any way 
> > other
> > than pinning to install the last stable version of Python on a stable
> > version of Debian?
> 
> Drop the idea that you have only one version of python3 installed, and
> that this version comes from Debian repositories.
> 
> Keep the python3 that's provided by Debian, for Debian's use.  It's
> part of package management and so on, and you really can't mess with
> it without breaking something.
> 
> Install *additional* versions of python3 as you need them, for your own
> development work.
> 
> I'll let the Python experts describe how to do this, if you don't already
> know how.  Last I heard, you're supposed to set up one python venv
> (virtual environment) for each version, but that information might be
> outdated.

You are, of course, entirely correct, but here's the obligatory xkcd:

https://xkcd.com/1987/

-- 
Celejar



Re: Follow recent stable Python versions

2023-06-22 Thread Manphiz


Yoann LE BARS  writes:

> Hello, everybody out there!
>
>   For the upcoming two years, I will have to follow the new versions of
>   Python. Not the preview release, but the up-to-date stable release –
>   well, I can wait for a couple of weeks after the release of the last
>   stable version.
>
>   As far as I know, Python is not part of backports. Is there any way
>   other than pinning to install the last stable version of Python on a
>   stable version of Debian?
>
>   Best regards.

You should follow Greg and Dan's suggestions to leave system installed
Python alone as it's used for the system and any unintended breaking
change will cause unexpected system failure.

To have a newer Python versions I would suggest using Docker.  Docker
hub has official Python images[1] which have testing and stable versions
available and using them won't mess up your system thanks to Docker's
properly contained environments.

[1] https://hub.docker.com/_/python
-- 
Manphiz



Re: Follow recent stable Python versions

2023-06-22 Thread Dan Ritter
Yoann LE BARS wrote: 
> 
> Hello, everybody out there!
> 
>   For the upcoming two years, I will have to follow the new versions of
> Python. Not the preview release, but the up-to-date stable release – well, I
> can wait for a couple of weeks after the release of the last stable version.
> 
>   As far as I know, Python is not part of backports. Is there any way 
> other
> than pinning to install the last stable version of Python on a stable
> version of Debian?

You will want to let the Debian python packages alone, and
install new pythons from source in /opt/python-VER or such. Then
use venvs to make sure that you are always getting the python
you really want.

Python source releases are here:

https://www.python.org/downloads/source/

Once you get one compiled, the process will be pretty similar
for any other.

-dsr-



Re: Follow recent stable Python versions

2023-06-22 Thread Greg Wooledge
On Fri, Jun 23, 2023 at 01:06:05AM +0200, Yoann LE BARS wrote:
>   As far as I know, Python is not part of backports. Is there any way 
> other
> than pinning to install the last stable version of Python on a stable
> version of Debian?

Drop the idea that you have only one version of python3 installed, and
that this version comes from Debian repositories.

Keep the python3 that's provided by Debian, for Debian's use.  It's
part of package management and so on, and you really can't mess with
it without breaking something.

Install *additional* versions of python3 as you need them, for your own
development work.

I'll let the Python experts describe how to do this, if you don't already
know how.  Last I heard, you're supposed to set up one python venv
(virtual environment) for each version, but that information might be
outdated.

This same principle applies to most programming languages.  If Debian
ships a compiler/interpreter for your language, then leave that version
alone.  Don't try to "upgrade" it.  If you need another version (older
or newer or just one with experimental patches), install that version
separately, in parallel with the Debian version.



Follow recent stable Python versions

2023-06-22 Thread Yoann LE BARS



Hello, everybody out there!

	For the upcoming two years, I will have to follow the new versions of 
Python. Not the preview release, but the up-to-date stable release – 
well, I can wait for a couple of weeks after the release of the last 
stable version.


	As far as I know, Python is not part of backports. Is there any way 
other than pinning to install the last stable version of Python on a 
stable version of Debian?


Best regards.

--
Yoann LE BARS
https://le-bars.net/yoann/



Re: recherche exemples de script Python pour GDB (deboguage du moteur d'inference RefPerSys)

2023-06-06 Thread didier gaumet

Le 06/06/2023 à 18:54, Basile Starynkevitch a écrit :

Bonsoir la liste,


Pour  déboguer le moteur d'inférence http://refpersys.org/ (en C++, sur 
Debian/Sid/x86-64 compilé avec GCC 12 ou GCC 13, code en cours de 
développement sur https://github.com/RefPerSys/RefPerSys ) je cherche 
des exemples (-sous licence libre, en français ou en anglais) 
d'extension de GDB 13 en Python.



C'est documenté comme possible, 
https://sourceware.org/gdb/current/onlinedocs/gdb.html/Python.html#Python mais je ne suis très familier avec Python.


J'aurais préféré coder le déboguage avec Guile, 
https://www.gnu.org/software/guile/ mais celui-ci semble moins bien 
supporté par GDB.


Bonjour,

Est-ce que
https://sourceware.org/gdb/current/onlinedocs/gdb.html/Guile.html#Guile
répond à ta question?
C'est que je crois comprendre, mais j'ai peut-être mal compris ta 
question au départ...


j'aurais alors eu des soucis à compiler GDB 13.2 sous Debian avec GCC 
13. Si vous savez le faire (en configurant GDB pour qu'il soit 
extensible avec GNU guile) donnez moi s'il vous plait des indications


Cordialement






recherche exemples de script Python pour GDB (deboguage du moteur d'inference RefPerSys)

2023-06-06 Thread Basile Starynkevitch

Bonsoir la liste,


Pour  déboguer le moteur d'inférence http://refpersys.org/ (en C++, sur 
Debian/Sid/x86-64 compilé avec GCC 12 ou GCC 13, code en cours de 
développement sur https://github.com/RefPerSys/RefPerSys ) je cherche 
des exemples (-sous licence libre, en français ou en anglais) 
d'extension de GDB 13 en Python.



C'est documenté comme possible, 
https://sourceware.org/gdb/current/onlinedocs/gdb.html/Python.html#Python 
mais je ne suis très familier avec Python.


J'aurais préféré coder le déboguage avec Guile, 
https://www.gnu.org/software/guile/ mais celui-ci semble moins bien 
supporté par GDB.



j'aurais alors eu des soucis à compiler GDB 13.2 sous Debian avec GCC 
13. Si vous savez le faire (en configurant GDB pour qu'il soit 
extensible avec GNU guile) donnez moi s'il vous plait des indications


Cordialement

--
Basile Starynkevitch  
(only mine opinions / les opinions sont miennes uniquement)
92340 Bourg-la-Reine, France
web page: starynkevitch.net/Basile/



Re: /libfreenect/build/wrappers/python/freenect3.c:747:10: fatal error: numpy/arrayobject.h: File or directory not found

2023-04-01 Thread Mario Marietto
Hello.

I have installed these packages on Debian 11 :

freenect/stable,now 1:0.5.3-2 amd64 [installed]
libfreenect-bin/stable,now 1:0.5.3-2 amd64 [installed, automatic]
libfreenect-demos/stable,now 1:0.5.3-2 amd64 [installed]
libfreenect-dev/stable,now 1:0.5.3-2 amd64 [installed]
libfreenect-doc/stable,stable,now 1:0.5.3-2 all [installed, automatic]
libfreenect0.5/stable,now 1:0.5.3-2 amd64 [installed, automatic]

What I really like to do is to choose the kinect xbox 360 as a mic. I find
it very comfortable to talk without having a mic in my mouth. I can use it
to send voice messages to my whatsapp and Telegram friends. I've already
done the same with the kinect 2 that I have attached to my Jetson nano and
it worked. But on the Jetson Nano I have installed Ubuntu 20.04. So,I would
like to know...what's still missing on Debian,after having installed the
packages that you see above ? Because I don't see any Xbox NUI Sensor
Analog Surround 4.0 on the XFCE pulseaudio addon (instead,it is present on
Ubuntu 20.04). Thanks.

On Sun, Apr 2, 2023 at 1:18 AM Kushal Kumaran  wrote:

> On Sat, Apr 01 2023 at 10:42:11 PM, Mario Marietto 
> wrote:
> > Hello.
> >
> > I'm trying to compile libfreenect because I want to use my kinect xbox
> 360
> > on Debian 11. I'm following the tutorial that I've found here :
> >
>
> libfreenect is already packaged in debian.  Is there a reason you're
> building from source?  It seems like quite a complex package to build.
> If you must, consider taking a look at the existing debian packaging for
> hints.
>
> > snipped numpy/cython errors
>
> --
> regards,
> kushal
>
>

-- 
Mario.


Re: /libfreenect/build/wrappers/python/freenect3.c:747:10: fatal error: numpy/arrayobject.h: File or directory not found

2023-04-01 Thread Kushal Kumaran
On Sat, Apr 01 2023 at 10:42:11 PM, Mario Marietto  
wrote:
> Hello.
>
> I'm trying to compile libfreenect because I want to use my kinect xbox 360
> on Debian 11. I'm following the tutorial that I've found here :
>

libfreenect is already packaged in debian.  Is there a reason you're
building from source?  It seems like quite a complex package to build.
If you must, consider taking a look at the existing debian packaging for
hints.

> snipped numpy/cython errors

-- 
regards,
kushal



/libfreenect/build/wrappers/python/freenect3.c:747:10: fatal error: numpy/arrayobject.h: File or directory not found

2023-04-01 Thread Mario Marietto
Hello.

I'm trying to compile libfreenect because I want to use my kinect xbox 360
on Debian 11. I'm following the tutorial that I've found here :

https://github.com/OpenKinect/libfreenect

here :

https://itsourcecode.com/modulenotfounderror/no-module-named-numpy-core-_multiarray_umath-solved/

here :

https://github.com/lava/matplotlib-cpp/issues/46

this is what I did :


# python3 --versionPython 3.8.10# /usr/bin/python3 --versionPython
3.8.10marietto@marietto:/mnt/zroot2/zroot2/libfreenect/build# sudo
cmake .. -L -DBUILD_PYTHON3=ON -DPython3_EXACTVERSION=3.8.10
-DCYTHON_EXECUTABLE=/usr/bin/cython3 -DBUILD_REDIST_PACKAGE=OFF
-DPYTHON_INCLUDE_DIR=/usr/local/lib/python3.8/dist-packages/numpy/core/include--
Operating system is Linux-- Got System Processor x86_64-- Linux x86_64
Detected-- libfreenect will be installed to /usr/local-- Headers will
be installed to /usr/local/include/libfreenect-- Libraries will be
installed to /usr/local/lib-- Found libusb-1.0:--  - Includes:
/usr/include/libusb-1.0--  - Libraries:
/usr/lib/x86_64-linux-gnu/libusb-1.0.soTraceback (most recent call
last):  File "/usr/local/lib/python3.8/numpy/core/__init__.py", line
23, in from . import multiarray  File
"/usr/local/lib/python3.8/numpy/core/multiarray.py", line 10, in
from . import overrides  File
"/usr/local/lib/python3.8/numpy/core/overrides.py", line 6, in
from numpy.core._multiarray_umath import
(ModuleNotFoundError: No module named
'numpy.core._multiarray_umath'During handling of the above exception,
another exception occurred:Traceback (most recent call last):  File
"", line 1, in   File
"/usr/local/lib/python3.8/numpy/__init__.py", line 141, in 
from . import core  File
"/usr/local/lib/python3.8/numpy/core/__init__.py", line 49, in
raise ImportError(msg)ImportError: IMPORTANT: PLEASE READ
THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!Importing the numpy
C-extensions failed. This error can happen formany reasons, often due
to issues with your setup or how NumPy wasinstalled.We have compiled
some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.htmlPlease
note and check the following:  * The Python version is: Python3.8 from
"/usr/local/bin/python3.8"  * The NumPy version is: "1.24.2"and make
sure that they are the versions you expect.Please carefully study the
documentation linked above for further help.Original error was: No
module named 'numpy.core._multiarray_umath'-- Configuring done
(0.6s)-- Generating done (0.0s)CMake Warning:  Manually-specified
variables were not used by the project:PYTHON_INCLUDE_DIR--
Build files have been written to:
/mnt/zroot2/zroot2/libfreenect/build-- Cache
valuesBUILD_AS3_SERVER:BOOL=OFFBUILD_CPACK_DEB:BOOL=OFFBUILD_CPACK_RPM:BOOL=OFFBUILD_CPACK_TGZ:BOOL=OFFBUILD_CPP:BOOL=ONBUILD_CV:BOOL=OFFBUILD_C_SYNC:BOOL=ONBUILD_EXAMPLES:BOOL=ONBUILD_FAKENECT:BOOL=ONBUILD_OPENNI2_DRIVER:BOOL=OFFBUILD_PYTHON:BOOL=OFFBUILD_PYTHON2:BOOL=OFFBUILD_PYTHON3:BOOL=ONBUILD_REDIST_PACKAGE:BOOL=OFFCMAKE_BUILD_TYPE:STRING=CMAKE_INSTALL_PREFIX:PATH=/usr/localCYTHON_EXECUTABLE:FILEPATH=/usr/bin/cython3LIBUSB_1_INCLUDE_DIR:PATH=/usr/include/libusb-1.0LIBUSB_1_LIBRARY:FILEPATH=/usr/lib/x86_64-linux-gnu/libusb-1.0.soPython2_EXACTVERSION:STRING=Python3_EXACTVERSION:STRING=3.8.10marietto@marietto:/mnt/zroot2/zroot2/libfreenect/build#
sudo makeAlready have audios.bin[  0%] Built target firmware[ 16%]
Built target freenect[ 32%] Built target freenectstatic[ 35%] Built
target freenect-camtest[ 39%] Built target freenect-wavrecord[ 42%]
Built target freenect-glview[ 46%] Built target freenect-regview[ 50%]
Built target freenect-hiview[ 53%] Built target freenect-chunkview[
57%] Built target freenect-micview[ 60%] Built target freenect_sync[
64%] Built target freenect-regtest[ 67%] Built target
freenect-tiltdemo[ 71%] Built target freenect-glpclview[ 78%] Built
target fakenect[ 83%] Built target fakenect-record[ 87%] Built target
freenect_sync_static[ 91%] Built target freenect-cppview[ 94%] Built
target freenect-cpp_pcview[ 96%] Building C object
wrappers/python/CMakeFiles/cython3_freenect.dir/freenect3.c.o/mnt/zroot2/zroot2/libfreenect/build/wrappers/python/freenect3.c:747:10:
fatal error: numpy/arrayobject.h: File o directory non esistente  747
| #include "numpy/arrayobject.h"  |
^compilation terminated.make[2]: ***
[wrappers/python/CMakeFiles/cython3_freenect.dir/build.make:80:
wrappers/python/CMakeFiles/cython3_freenect.dir/freenect3.c.o] Errore
1make[1]: *** [CMakeFiles/Makefile2:741:
wrappers/python/CMakeFiles/cython3_freenect.dir/all] Errore 2make: ***
[Makefile:136: all] Errore 2

-- 
Mario.


Re: Fw: python thinking at debian

2023-02-21 Thread Max Nikulin

On 20/02/2023 20:59, Vic Cekvenich wrote:
...
I think that is the goal for all 
of us.

...
I did/do apt install python3-pip and python3-venv and python ensurepip 
still does not work. But if I do pyenv to build, all of python works well.


There is large gap between too generic goal "can develop" and too 
specific issue that ensurepip does not work for you. Details related to 
intermediate level task is missed, so it is difficult to say if it is a 
real problem or just a bit different way for similar actions is assumed 
by developers. What you consider as restrictions may help to ensure that 
other packages can rely on sane enough environment.


Debian bug tracker or mailing list archive may contain discussion why 
some limitations were added and what approach (venv, etc.) allows to get 
work done.


/usr/share/doc/python3.*-venv/README.Debian
/usr/share/doc/python3/python-policy.txt.gz
May contain some hints.




Re: Fw: python thinking at debian

2023-02-20 Thread Dan Ritter
Vic Cekvenich wrote: 
> Hi Dan, thx for a response.
> 
> I am trying to avoid building python.
> 
> I currently do that via pyenv for the system python and it makes debian
> unstable(as 'my' python in /usr/local fights with other system packages in
> /bin. I'd like to think that debian also would like to help in us devs not
> having to build system python. I think that is the goal for all of us.
> (of course dev python is in $HOME/.local/bin, that works perfect for aoo of
> development. But three are system apps that use system python, maybe the
> should not but they do.)

Debian doesn't want you to build or replace system python unless
you are specifically trying to fix a bug for Debian python; in
which case you should be coordinating with the Debian Python
people.

https://www.debian.org/doc/packaging-manuals/python-policy/

If you need an advanced version of Python for one or more
programs of your own, placing that in /usr/local or /opt is a
good idea. Using a venv to encapsulate those programs is an
extremely good idea. That also works for clashing modulve
versions. 

-dsr-



Re: Fw: python thinking at debian

2023-02-20 Thread Vic Cekvenich

Hi Dan, thx for a response.

I am trying to avoid building python.

I currently do that via pyenv for the system python and it makes debian 
unstable(as 'my' python in /usr/local fights with other system packages 
in /bin. I'd like to think that debian also would like to help in us 
devs not having to build system python. I think that is the goal for all 
of us.
(of course dev python is in $HOME/.local/bin, that works perfect for aoo 
of development. But three are system apps that use system python, maybe 
the should not but they do.)


I did/do apt install python3-pip and python3-venv and python ensurepip 
still does not work. But if I do pyenv to build, all of python works well.

Cheers, Vic

On 2/20/23 5:59 AM, Dan Ritter wrote:

Vic Cekvenich wrote:


I can't figure out how to file a bug. But I see a bug related to ensurepip - 
and some maintainer said that ensurepip is used by developers and won't be 
fixed by debian.

But you also won't let us that develop fix it. 


What are you trying to do that can't be done with python3-pip
and python3-venv?

-dsr-




Re: Fw: python thinking at debian

2023-02-20 Thread Dan Ritter
Vic Cekvenich wrote: 
> 
> I can't figure out how to file a bug. But I see a bug related to ensurepip - 
> and some maintainer said that ensurepip is used by developers and won't be 
> fixed by debian.
> 
> But you also won't let us that develop fix it.  In ubuntu, they even have a 
> repo for ptyhon to help developers (deadsnakes or something like that).
> So at debian.. you won't fix it and you won't let devs fix it.
> 
> I do appreciate the open source contribution, I have done a bit of OS and it 
> is pita, so I am thankfull. But let us developers break the system if we 
> wish. You are driving us to ubuntu just so we can develop.


What are you trying to do that can't be done with python3-pip
and python3-venv?

-dsr-



Fw: python thinking at debian

2023-02-19 Thread Vic Cekvenich

I can't figure out how to file a bug. But I see a bug related to ensurepip - 
and some maintainer said that ensurepip is used by developers and won't be 
fixed by debian.

But you also won't let us that develop fix it.  In ubuntu, they even have a 
repo for ptyhon to help developers (deadsnakes or something like that).
So at debian.. you won't fix it and you won't let devs fix it.

I do appreciate the open source contribution, I have done a bit of OS and it is 
pita, so I am thankfull. But let us developers break the system if we wish. You 
are driving us to ubuntu just so we can develop.

Anyway, I'm sure I have done things and this will be ignore, but maybe you get 
other input on this and allow us to use debina for D12/bookworm.
Cheers, Vic

error:
# python -m ensurepip
ensurepip is disabled in Debian/Ubuntu for the system python.

Python modules for the system python are usually handled by dpkg and apt-get.

apt-get install python-

Install the python-pip package to use pip itself.  Using pip together
with the system python might have unexpected results for any system installed
module, so use it on your own risk, or make sure to only use it in virtual
environments.


Re: Python curses

2023-01-10 Thread Nate Bargmann
* On 2023 10 Jan 13:38 -0600, pa...@quillandmouse.com wrote:
> It may be argued that I shouldn't do the import this way. However, I
> prefer to have "curses." in front of things imported. It makes the link
> explicit, and serves to remind me of what's actually going on, when I
> revisit the code in five years.

I agree with your reasoning.  I never liked the "from foo import *"
syntax.  OTOH, it does have its use when wanting to import a subset of a
module.  For example, "from foo import bar" that would make the "bar"
name a part of the main namespace..

Then there is the "import fooBarBaz as fBB" syntax which is useful to
shorten long module names, as I understand it (the name after the "as"
can be any legal Python identifier).  There are some modules with
submodules that make the long name prefix onerous.

As I've poked around the Web over the years its clear that some like the
simplicity of "from foo import *".  I think doing that as an example is
a mistake as it hides the classes, methods, variables module prefix.
Just be aware that when you find an example that imports in this manner
that there is an implicit module name prefix but it isn't used since the
import command made the module's namespace a part of the program's main
namespace.

That's how I understand it, at least.

- Nate

-- 
"The optimist proclaims that we live in the best of all
possible worlds.  The pessimist fears this is true."
Web: https://www.n0nb.us
Projects: https://github.com/N0NB
GPG fingerprint: 82D6 4F6B 0E67 CD41 F689 BBA6 FB2C 5130 D55A 8819



signature.asc
Description: PGP signature


Re: Python curses

2023-01-10 Thread paulf
On Tue, 10 Jan 2023 13:17:10 -0600
David Wright  wrote:

> On Tue 10 Jan 2023 at 11:13:55 (-0500), pa...@quillandmouse.com wrote:
> > On Tue, 10 Jan 2023 09:31:26 -0600 > David Wright
> >  wrote:
> 
> > > You keep mentioning "the docs" without saying which docs, so a
> > > reference might be helpful.
> > 
> > Sorry. I'm using the following (and related pages):
> > 
> > https://docs.python.org/3/library/curses.html
> > 
> > These appear to be the most authoritative.
> 
> Correct.
> 
> > > On Tue 10 Jan 2023 at 09:01:17 (-0500), pa...@quillandmouse.com
> > > wrote:
> > > > On Tue, 10 Jan 2023 08:34:05 -0500 Greg Wooledge
> > > >  wrote:
> > > > > On Tue, Jan 10, 2023 at 08:24:11AM -0500,
> > > > > pa...@quillandmouse.com wrote:
> > > > > > What you wrote triggered something. I'd been following the
> > > > > > Python curses docs, which tell you to write, for example,
> > > > > > "A_REVERSE".
> 
> No, they don't.
> 
> > > > > > And Python was throwing exceptions. But based on
> > > > > > what you wrote, I substituted "curses.A_REVERSE", which
> > > > > > works.
> > > > > > 
> > > > > > Problem solved... for now.
> > > 
> > > Exactly: just for now.
> > > 
> > > > > I'm a Python novice, but I believe what you're seeing is the
> > > > > difference between
> > > > 
> > > > No, here's what happened. I was going along, and I used
> > > > "A_REVERSE" in my code, according to the online docs.
> > > > Exception, didn't recognize the name. That didn't make sense;
> > > > this attribute is basic to curses.
> 
> Exactly, it's an attribute, as shown by the heading of the table
> in which you found A_REVERSE. And that attribute is a part of
> the curses module, and must be qualified with curses.A_REVERSE
> unless you import A_REVERSE (or all, *) into your namespace.
> 

Correct. Actually, this should have been obvious to me if I'd been
thinking clearly. Doing a "import curses" shouldn't make bare library
symbols available in your code. It only makes sense you'd need to
address them with a prefix.

It may be argued that I shouldn't do the import this way. However, I
prefer to have "curses." in front of things imported. It makes the link
explicit, and serves to remind me of what's actually going on, when I
revisit the code in five years.

Paul

-- 
Paul M. Foster
Personal Blog: http://noferblatz.com
Company Site: http://quillandmouse.com
Software Projects: https://gitlab.com/paulmfoster



Re: Python curses

2023-01-10 Thread David Wright
On Tue 10 Jan 2023 at 11:13:55 (-0500), pa...@quillandmouse.com wrote:
> On Tue, 10 Jan 2023 09:31:26 -0600 > David Wright  
> wrote:

> > You keep mentioning "the docs" without saying which docs, so a
> > reference might be helpful.
> 
> Sorry. I'm using the following (and related pages):
> 
> https://docs.python.org/3/library/curses.html
> 
> These appear to be the most authoritative.

Correct.

> > On Tue 10 Jan 2023 at 09:01:17 (-0500), pa...@quillandmouse.com wrote:
> > > On Tue, 10 Jan 2023 08:34:05 -0500 Greg Wooledge  
> > > wrote:
> > > > On Tue, Jan 10, 2023 at 08:24:11AM -0500, pa...@quillandmouse.com wrote:
> > > > > What you wrote triggered something. I'd been following the
> > > > > Python curses docs, which tell you to write, for example,
> > > > > "A_REVERSE".

No, they don't.

> > > > > And Python was throwing exceptions. But based on
> > > > > what you wrote, I substituted "curses.A_REVERSE", which works.
> > > > > 
> > > > > Problem solved... for now.
> > 
> > Exactly: just for now.
> > 
> > > > I'm a Python novice, but I believe what you're seeing is the
> > > > difference between
> > > 
> > > No, here's what happened. I was going along, and I used "A_REVERSE"
> > > in my code, according to the online docs. Exception, didn't
> > > recognize the name. That didn't make sense; this attribute is basic
> > > to curses.

Exactly, it's an attribute, as shown by the heading of the table
in which you found A_REVERSE. And that attribute is a part of
the curses module, and must be qualified with curses.A_REVERSE
unless you import A_REVERSE (or all, *) into your namespace.

What has misled you is that all the /tables/ in the python
documentation have just the last component's name in column one,
with its interpretation in column two. If you want to see why,
glance at a page like
  file:///usr/share/doc/python3/html/library/collections.abc.html
for example. The first ABC item in the table is "Container",
but the running text below shows:

  class collections.abc.Container
 ABC for classes that provide the __contains__() method.

The table would be unmanageable if most of its width was taken
up with repetitions of:

  class collections.abc.…   …   …   …
  class collections.abc.…   …   …   …
  class collections.abc.…   …   …   …
  class collections.abc.…   …   …   …
  class collections.abc.…   …   …   …
  class collections.abc.…   …   …   …

Cheers,
David.


Re: Python curses

2023-01-10 Thread Curt
On 2023-01-10,   wrote:
>
> Follow-up question, in case you know this too: apparently, when you
> purchase a Kindle book and read it via the Kindle app on your Android
> phone, the document doesn't exist on the phone itself. I've

https://pennbookcenter.com/where-are-kindle-books-stored-on-android/

Just one of the multiple if not myriad pages available on the subject
via a search engine.



Re: Python curses

2023-01-10 Thread paulf
On Tue, 10 Jan 2023 09:31:26 -0600
David Wright  wrote:

> On Tue 10 Jan 2023 at 09:01:17 (-0500), pa...@quillandmouse.com wrote:
> > On Tue, 10 Jan 2023 08:34:05 -0500 Greg Wooledge
> >  wrote:
> > > On Tue, Jan 10, 2023 at 08:24:11AM -0500, pa...@quillandmouse.com
> > > wrote:
> > > > What you wrote triggered something. I'd been following the
> > > > Python curses docs, which tell you to write, for example,
> > > > "A_REVERSE". And Python was throwing exceptions. But based on
> > > > what you wrote, I substituted "curses.A_REVERSE", which works.
> > > > 
> > > > Problem solved... for now.
> 
> Exactly: just for now.
> 
> > > I'm a Python novice, but I believe what you're seeing is the
> > > difference between
> > 
> > No, here's what happened. I was going along, and I used "A_REVERSE"
> > in my code, according to the online docs. Exception, didn't
> > recognize the name. That didn't make sense; this attribute is basic
> > to curses. So I started investigated versions of Python, ncurses,
> > Python curses, etc.
> > 
> > But as it turns out, instead of typing "A_REVERSE", I should have
> > ignored the docs and typed "curses.A_REVERSE". That worked, and
> > obviated the whole versioning problem.
> 
> You keep mentioning "the docs" without saying which docs, so a
> reference might be helpful.

Sorry. I'm using the following (and related pages):

https://docs.python.org/3/library/curses.html

These appear to be the most authoritative.

Paul

-- 
Paul M. Foster
Personal Blog: http://noferblatz.com
Company Site: http://quillandmouse.com
Software Projects: https://gitlab.com/paulmfoster



Re: Python curses

2023-01-10 Thread Dan Ritter
pa...@quillandmouse.com wrote: 
> On Tue, 10 Jan 2023 08:11:28 -0500
> Dan Ritter  wrote:
> 
> > The Debian package calibre contains:
> > 
> > - an X11 application which is an all-singing, all-dancing
> > library manager and ebook reader
> > 
> > - a set of CLI-usable conversion utilities, most importantly
> > 'ebook-convert', which figures out the input format
> > automatically and exports to a large number of output formats,
> > most usefully EPUB and PDF.
> > 
> 
> Follow-up question, in case you know this too: apparently, when you
> purchase a Kindle book and read it via the Kindle app on your Android
> phone, the document doesn't exist on the phone itself. I've
> plugged my phone into my PC and examined every directory under Android
> and the SIM card, and I can't find a trace of the Kindle book I
> purchased.
> 
> I've installed Calibre, but without having the Kindle file in hand, I
> can't convert it. So... any idea how to actually pry the Kindle file
> out of Amazon's greedy hands, so I can point Calibre at it?

https://www.epubor.com/the-ultimate-guide-to-download-kindle-books.html

appears to be up-to-date. I don't actually use Amazon for media
purchases/rentals, myself.

-dsr-



Re: Python curses

2023-01-10 Thread David Wright
On Tue 10 Jan 2023 at 09:01:17 (-0500), pa...@quillandmouse.com wrote:
> On Tue, 10 Jan 2023 08:34:05 -0500 Greg Wooledge  wrote:
> > On Tue, Jan 10, 2023 at 08:24:11AM -0500, pa...@quillandmouse.com wrote:
> > > What you wrote triggered something. I'd been following the Python
> > > curses docs, which tell you to write, for example, "A_REVERSE". And
> > > Python was throwing exceptions. But based on what you wrote, I
> > > substituted "curses.A_REVERSE", which works.
> > > 
> > > Problem solved... for now.

Exactly: just for now.

> > I'm a Python novice, but I believe what you're seeing is the
> > difference between
> 
> No, here's what happened. I was going along, and I used "A_REVERSE" in
> my code, according to the online docs. Exception, didn't recognize the
> name. That didn't make sense; this attribute is basic to curses. So I
> started investigated versions of Python, ncurses, Python curses, etc.
> 
> But as it turns out, instead of typing "A_REVERSE", I should have
> ignored the docs and typed "curses.A_REVERSE". That worked, and
> obviated the whole versioning problem.

You keep mentioning "the docs" without saying which docs, so a
reference might be helpful. I'm finding that most online docs
I hit by googling   python curses docs   use examples that:

  import curses

thereby only importing the module's name into the local namespace,
or else import just a selection of attributes into the local
namespace, as in:

  from curses import wrapper

To fully answer your question, we need to see how your docs had
imported curses before using its attributes without qualification.

It's difficult to conceive of doing much python programming without
understanding the distinction being made here by Greg and tomas.
You should read "The import statement" section in the Python
Language Reference:
file:///usr/share/doc/python3/html/reference/simple_stmts.html#the-import-statement

BTW in the many years I used python seriously as part of my job,
I never used "from mod import *" except where I'd written the
module concerned, and had total control over the few, unique,
attribute names that it defined.

Cheers,
David.



Re: Python curses

2023-01-10 Thread tomas
On Tue, Jan 10, 2023 at 02:48:26PM +, Tixy wrote:

[...]

> I doubt that's possible because I assume these things are protected
> with DRM to stop people from copying them, or escaping the clutches of
> Big Corp who want to monitor what you do in order to sell you more
> stuff.

I have yet to see a DRM which can't be circumvented. Granted, with
"trusted computing" we are inching closer, but that thing is still
full of holes.

Cheers
-- 
t


signature.asc
Description: PGP signature


Re: Python curses

2023-01-10 Thread Tixy
On Tue, 2023-01-10 at 09:18 -0500, pa...@quillandmouse.com wrote:
> Follow-up question, in case you know this too: apparently, when you
> purchase a Kindle book and read it via the Kindle app on your Android
> phone, the document doesn't exist on the phone itself. I've
> plugged my phone into my PC and examined every directory under Android
> and the SIM card, and I can't find a trace of the Kindle book I
> purchased.

Because you didn't purchase it. You paid for the right to read it
whenever you want, until such time as Amazon decided to shut down the
Kindle service that is. Or it decides you shouldn't have been sold it
and deletes it. [1] That's how digital 'purchases' work.

> 
> I've installed Calibre, but without having the Kindle file in hand, I
> can't convert it. So... any idea how to actually pry the Kindle file
> out of Amazon's greedy hands, so I can point Calibre at it?

I doubt that's possible because I assume these things are protected
with DRM to stop people from copying them, or escaping the clutches of
Big Corp who want to monitor what you do in order to sell you more
stuff.

[1] https://www.theregister.com/2009/07/18/amazon_removes_1984_from_kindle/

-- 
Tixy



Re: Python curses

2023-01-10 Thread paulf
On Tue, 10 Jan 2023 08:11:28 -0500
Dan Ritter  wrote:

> pa...@quillandmouse.com wrote: 
> > On Tue, 10 Jan 2023 21:29:31 +1100
> > David  wrote:
> > 
> > > On Tue, 10 Jan 2023 at 15:04,  wrote:
> > > >
> > > > I'm trying to write some code in Python's curses module.
> > > 
> > > Hi,
> > > 
> > > This kindle/paperback book [1][2] might also be of interest.
> > > 
> > 
> > Don't like Amazon's vendor lock with Kindle. Do you know of a
> > simple, accessible way of converting a Kindle book to something I
> > can read on my PC?
> 
> The Debian package calibre contains:
> 
> - an X11 application which is an all-singing, all-dancing
> library manager and ebook reader
> 
> - a set of CLI-usable conversion utilities, most importantly
> 'ebook-convert', which figures out the input format
> automatically and exports to a large number of output formats,
> most usefully EPUB and PDF.
> 

Follow-up question, in case you know this too: apparently, when you
purchase a Kindle book and read it via the Kindle app on your Android
phone, the document doesn't exist on the phone itself. I've
plugged my phone into my PC and examined every directory under Android
and the SIM card, and I can't find a trace of the Kindle book I
purchased.

I've installed Calibre, but without having the Kindle file in hand, I
can't convert it. So... any idea how to actually pry the Kindle file
out of Amazon's greedy hands, so I can point Calibre at it?

Paul



-- 
Paul M. Foster
Personal Blog: http://noferblatz.com
Company Site: http://quillandmouse.com
Software Projects: https://gitlab.com/paulmfoster



Re: Python curses

2023-01-10 Thread tomas
On Tue, Jan 10, 2023 at 09:01:17AM -0500, pa...@quillandmouse.com wrote:
> On Tue, 10 Jan 2023 08:34:05 -0500
> Greg Wooledge  wrote:
> 
> > On Tue, Jan 10, 2023 at 08:24:11AM -0500, pa...@quillandmouse.com
> > wrote:
> > > What you wrote triggered something. I'd been following the Python
> > > curses docs, which tell you to write, for example, "A_REVERSE". And
> > > Python was throwing exceptions. But based on what you wrote, I
> > > substituted "curses.A_REVERSE", which works.
> > > 
> > > Problem solved... for now.
> > 
> > I'm a Python novice, but I believe what you're seeing is the
> > difference between
> 
> No, here's what happened. I was going along, and I used "A_REVERSE" in
> my code, according to the online docs. Exception, didn't recognize the
> name. That didn't make sense; this attribute is basic to curses. So I
> started investigated versions of Python, ncurses, Python curses, etc.
> 
> But as it turns out, instead of typing "A_REVERSE", I should have
> ignored the docs and typed "curses.A_REVERSE". That worked, and
> obviated the whole versioning problem.

Greg is still right, though:

If you say "import curses", then you have to say "curses.A_REVERSE"
later on. If you say "from curses import *", then it's "A_REVERSE".

The difference between importing a package and importing all of
the packages's symbols.

What you want to do depends on preferences, taste, name collissions
and things.

Cheers
-- 
t


signature.asc
Description: PGP signature


Re: Python curses

2023-01-10 Thread paulf
On Tue, 10 Jan 2023 08:34:05 -0500
Greg Wooledge  wrote:

> On Tue, Jan 10, 2023 at 08:24:11AM -0500, pa...@quillandmouse.com
> wrote:
> > What you wrote triggered something. I'd been following the Python
> > curses docs, which tell you to write, for example, "A_REVERSE". And
> > Python was throwing exceptions. But based on what you wrote, I
> > substituted "curses.A_REVERSE", which works.
> > 
> > Problem solved... for now.
> 
> I'm a Python novice, but I believe what you're seeing is the
> difference between

No, here's what happened. I was going along, and I used "A_REVERSE" in
my code, according to the online docs. Exception, didn't recognize the
name. That didn't make sense; this attribute is basic to curses. So I
started investigated versions of Python, ncurses, Python curses, etc.

But as it turns out, instead of typing "A_REVERSE", I should have
ignored the docs and typed "curses.A_REVERSE". That worked, and
obviated the whole versioning problem.

Paul

-- 
Paul M. Foster
Personal Blog: http://noferblatz.com
Company Site: http://quillandmouse.com
Software Projects: https://gitlab.com/paulmfoster



Re: Python curses

2023-01-10 Thread Greg Wooledge
On Tue, Jan 10, 2023 at 08:24:11AM -0500, pa...@quillandmouse.com wrote:
> What you wrote triggered something. I'd been following the Python
> curses docs, which tell you to write, for example, "A_REVERSE". And
> Python was throwing exceptions. But based on what you wrote, I
> substituted "curses.A_REVERSE", which works.
> 
> Problem solved... for now.

I'm a Python novice, but I believe what you're seeing is the difference
between

import curses

and

from curses import *

Compare and contrast:

unicorn:~$ python3
Python 3.9.2 (default, Feb 28 2021, 17:03:44) 
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> re.sub('a*', '', 'aardvark')
'rdvrk'

unicorn:~$ python3
Python 3.9.2 (default, Feb 28 2021, 17:03:44) 
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from re import *
>>> sub('a*', '', 'aardvark')
'rdvrk'



Re: Python curses

2023-01-10 Thread Dan Ritter
pa...@quillandmouse.com wrote: 
> On Tue, 10 Jan 2023 21:29:31 +1100
> David  wrote:
> 
> > On Tue, 10 Jan 2023 at 15:04,  wrote:
> > >
> > > I'm trying to write some code in Python's curses module.
> > 
> > Hi,
> > 
> > This kindle/paperback book [1][2] might also be of interest.
> > 
> 
> Don't like Amazon's vendor lock with Kindle. Do you know of a simple,
> accessible way of converting a Kindle book to something I can read on
> my PC?

The Debian package calibre contains:

- an X11 application which is an all-singing, all-dancing
library manager and ebook reader

- a set of CLI-usable conversion utilities, most importantly
'ebook-convert', which figures out the input format
automatically and exports to a large number of output formats,
most usefully EPUB and PDF.

-dsr-



Re: Python curses

2023-01-10 Thread paulf
On Tue, 10 Jan 2023 03:21:11 -0600
Nate Bargmann  wrote:

> * On 2023 09 Jan 22:05 -0600, pa...@quillandmouse.com wrote:
> > Folks:
> 
> I'm not python curses expert, but is what I found.
> 
> > I'm trying to write some code in Python's curses module. I've run
> > into common curses items like A_NORMAL which don't exist. When I do
> > a print(curses.version), it shows "b 2.2". This tells me that the
> > Debian (testing) version of python curses is version 2.2. The
> > documentation for python curses at docs.python.org mentions
> > versions up to 3.10.
> 
> Presumably you're running Bullseye as am I.  Here is what I show:

I'm actually on testing. The Python version is 3.10.x

> 
> Python 3.9.2 (default, Feb 28 2021, 17:03:44) 
> [GCC 10.2.1 20210110] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import curses
> >>> print(curses.version)
> b'2.2'
> >>> dir()
> ['__annotations__', '__builtins__', '__doc__', '__loader__',
> '__name__', '__package__', '__spec__', 'curses']
> >>> dir(curses)
> [...(snip lots of stuff), 'A_NORMAL', (snip even more stuff)]
> 
> >>> curses.A_NORMAL
> 0
> >>> curses.A_PROTECT
> 16777216
> >>> curses.A_BOLD
> 2097152
> >>> curses.A_COLOR
> 65280
> 
> Do you get similar values for those constants?

What you wrote triggered something. I'd been following the Python
curses docs, which tell you to write, for example, "A_REVERSE". And
Python was throwing exceptions. But based on what you wrote, I
substituted "curses.A_REVERSE", which works.

Problem solved... for now.

Paul

-- 
Paul M. Foster
Personal Blog: http://noferblatz.com
Company Site: http://quillandmouse.com
Software Projects: https://gitlab.com/paulmfoster



Re: Python curses

2023-01-10 Thread paulf
On Tue, 10 Jan 2023 21:29:31 +1100
David  wrote:

> On Tue, 10 Jan 2023 at 15:04,  wrote:
> >
> > I'm trying to write some code in Python's curses module.
> 
> Hi,
> 
> This kindle/paperback book [1][2] might also be of interest.
> 

Don't like Amazon's vendor lock with Kindle. Do you know of a simple,
accessible way of converting a Kindle book to something I can read on
my PC?

[snip]
 
> The author is a moderator of the python-tutor mailing list [4], and
> very helpful on there, so that also might be a good place to ask
> any questions you might have.

Thanks. I'm principally a PHP programmer, and several things about
Python irk me. So that help might be pretty useful.

Paul

-- 
Paul M. Foster
Personal Blog: http://noferblatz.com
Company Site: http://quillandmouse.com
Software Projects: https://gitlab.com/paulmfoster



Re: Python curses

2023-01-10 Thread David
On Tue, 10 Jan 2023 at 15:04,  wrote:
>
> I'm trying to write some code in Python's curses module.

Hi,

This kindle/paperback book [1][2] might also be of interest.

Don't be discouraged by "amazon.com" or "book", the price is very low
(showing $1.50 -- $6.00) as explained here [3].

Disclaimer: I have not read it, but if I was going to do anything
in curses with Python then I would start by reading it.

The author is a moderator of the python-tutor mailing list [4], and
very helpful on there, so that also might be a good place to ask
any questions you might have.

[1] 
https://www.amazon.com/Programming-curses-Python-Alan-Gauld-ebook/dp/B091B85B77
[2] https://mail.python.org/pipermail/tutor/2021-March/118153.html
[3] https://mail.python.org/pipermail/tutor/2021-March/118143.html
[4] https://mail.python.org/mailman/listinfo/tutor



Re: Python curses

2023-01-10 Thread Nate Bargmann
* On 2023 09 Jan 22:05 -0600, pa...@quillandmouse.com wrote:
> Folks:

I'm not python curses expert, but is what I found.

> I'm trying to write some code in Python's curses module. I've run into
> common curses items like A_NORMAL which don't exist. When I do a
> print(curses.version), it shows "b 2.2". This tells me that the Debian
> (testing) version of python curses is version 2.2. The documentation
> for python curses at docs.python.org mentions versions up to 3.10.

Presumably you're running Bullseye as am I.  Here is what I show:

Python 3.9.2 (default, Feb 28 2021, 17:03:44) 
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import curses
>>> print(curses.version)
b'2.2'
>>> dir()
['__annotations__', '__builtins__', '__doc__', '__loader__', '__name__', 
'__package__', '__spec__', 'curses']
>>> dir(curses)
[...(snip lots of stuff), 'A_NORMAL', (snip even more stuff)]

>>> curses.A_NORMAL
0
>>> curses.A_PROTECT
16777216
>>> curses.A_BOLD
2097152
>>> curses.A_COLOR
65280

Do you get similar values for those constants?

> Is it really possible that the latest version of Python in Debian
> testing is linked to (or however it works) the 2.2 version of Python
> curses?

Yes.  I'm not familiar at all with the versioning of such modules.
Perhaps the Python folks have decided to normalize the versions of
modules with the main interpreter version resulting in an apparent
version jump.

The curses module should be a rather old and stable module so I would
expect it to be fully functional and quite well debugged.

> If someone has insights here, I'd be grateful.

Looking at /usr/include/curses.h on Bullseye at line 1059 it can be seen
how ncurses defines A_NORMAL to be 0.

- Nate

-- 
"The optimist proclaims that we live in the best of all
possible worlds.  The pessimist fears this is true."
Web: https://www.n0nb.us
Projects: https://github.com/N0NB
GPG fingerprint: 82D6 4F6B 0E67 CD41 F689 BBA6 FB2C 5130 D55A 8819



signature.asc
Description: PGP signature


Python curses

2023-01-09 Thread paulf
Folks:

I'm trying to write some code in Python's curses module. I've run into
common curses items like A_NORMAL which don't exist. When I do a
print(curses.version), it shows "b 2.2". This tells me that the Debian
(testing) version of python curses is version 2.2. The documentation
for python curses at docs.python.org mentions versions up to 3.10.

Is it really possible that the latest version of Python in Debian
testing is linked to (or however it works) the 2.2 version of Python
curses?

If someone has insights here, I'd be grateful.

Paul

-- 
Paul M. Foster
Personal Blog: http://noferblatz.com
Company Site: http://quillandmouse.com
Software Projects: https://gitlab.com/paulmfoster



Re: [bullseye] ganglia-monitor-python compatibility

2022-10-28 Thread Dan Ritter
Bardo Bardo wrote: 
> Hi,
> 
> Ganglia has some useful monitoring plugins such as diskstat, mysql,
> postgresql, elasticsearch, advanced cpu metrics, ... i'm using theses
> metrics for years, but since Debian 11 these modules are no longer
> available,
> Is there any idea why the package Ganglia Python Modules
> <https://packages.debian.org/buster/ganglia-monitor-python> is no longer
> supported on Debian Bullseye ? Is this a kernel incompatibility issue or
> Python related problem ? Is there a workaround solution to use some of
> these monitoring plugins ?


Looking through the mailing list and
https://tracker.debian.org/pkg/ganglia

I suspect that it did not have an active maintainer at the time
that bullseye was being assembled, and it had enough problems
that it did not make it into that release. There is a new
maintainer as of last year, but it doesn't look like much
activity has happened since.

-dsr-



[bullseye] ganglia-monitor-python compatibility

2022-10-27 Thread Bardo Bardo
Hi,

Ganglia has some useful monitoring plugins such as diskstat, mysql,
postgresql, elasticsearch, advanced cpu metrics, ... i'm using theses
metrics for years, but since Debian 11 these modules are no longer
available,
Is there any idea why the package Ganglia Python Modules
<https://packages.debian.org/buster/ganglia-monitor-python> is no longer
supported on Debian Bullseye ? Is this a kernel incompatibility issue or
Python related problem ? Is there a workaround solution to use some of
these monitoring plugins ?

Thanks and have a nice day :)
--


[Python] quelqu'un la lu ? l'utilise ?

2022-09-22 Thread ptilou
bonjour,

je reviser mon cours et je tombe sur ce livre :
et donc cela est adapte a quel squelette ?
c'est utilise sur quel platforme ?

merci

About the Author

James Ma Weiming works with high-frequency, low-latency trading systems,

writing his own programs and tools, most of which are open sourced. He is 
currently

supporting veteran traders in the, trading pits of the Chicago Board of Trade 
devising

strategies to game the market. He graduated from the Stuart School of Business 
at

Illinois Institute of Technology with a master of science degree in nance.

He started his career in Singapore after receiving his bachelor's degree in 
computer

engineering from Nanyang Technological University and diploma in information

technology from Nanyang Polytechnic. During his career, he has worked in 

treasury operations handling foreign exchange and xed income products. He also

developed mobile applications with a company operating a funds and investments

distribution platform.
Auteur(s): Weiming, James Ma
Editeur: Packt Publishing
Année de Publication: 2015
pages: 340
ISBN: 978-1-78439-451-6
eISBN: 978-1-78439-787-6
 Built initially for scientific computing, Python quickly found its place in 
finance. Its flexibility and robustness can be easily incorporated into 
applications for mathematical studies, research, and software development.
With this book, you will learn about all the tools you need to successfully 
perform research studies and modeling, improve your trading strategies, and 
effectively manage risks. You will explore the various tools and techniques 
used in solving complex problems commonly faced in finance.
You will learn how to price financial instruments such as stocks, options, 
interest rate derivatives, and futures using computational methods. Also, you 
will learn how you can perform data analytics on market indexes and use NoSQL 
to store tick data.
 
-- 
ptilou



Re: Questions Python

2022-08-31 Thread Pierre ESTREM

Bonjour Marc et le Monde,

La réponse est ici :
https://www.developpez.net/forums/d1474088/autres-langages/python/gui/tkinter/obtenir-nom-widget-focus/

Mais j'ai fait un peu autrement.
On utilise la propriété "_name" qu'il faut donc fixer à la création du 
widget.


# Un extrait

# Une fenêtre principale
master=TK()

# du code ...

widget=mater.focus_get()

bouton1=Button(master)
bouton1._name="bouton1"
bouton1.pack()

#  et plein d'autres widgets !

# Afficherait "bouton1" si il a le focus
print(widget._name)

master.mailoop()

# Fin

Et ceci m'ouvre des perspectives énormes...

a+
pierre estrem


Le 31/08/2022 à 07:45, Marc Chantreux a écrit :

salut Pierre,

On Tue, Aug 30, 2022 at 07:31:58PM +0200, Pierre ESTREM wrote:

   widget = master.focus_get()
    print(widget()) # Aucun retour

vraiment: je t'encourage à reposer la question sur le forum de l'afpy.

* ce tu trouveras des gens plus motivés et connaisseurs pour répondre à cette 
question
* je pense que ce genre de questions est vraiment hors sujet ici (en
   tout cas pour ma part je ne suis plus sur les listes python justement
   parce que ce langage me ... laisse dubitatif :))


bonne chance.





Re: OT - "tuples" en Python

2022-08-31 Thread sergiogomez
El 2022-08-31 12:32, Debian escribió:

> El 31/8/22 a las 12:27, Roberto C. Sánchez escribió: On Wed, Aug 31, 2022 at 
> 12:18:39PM -0300, Debian wrote: Buen día.
> 
> Estoy aprendiendo Python. Y como no puede ser de otra manera, la
> bibliografía está en inglés, o spanglish.
> 
> Entiendo informáticamente lo que es "tuples" según el diccionario Oxford: "a
> data structure consisting of multiple parts", o sea, una lista consistente e
> inalterable.
> 
> Ahora bien; no encuentro la traducción al español en el DRAE.
> Se estaría usando una palabra "spanglish" que es "tupla".
> 
> ¿Es correcto este término, o hay alguno más específico?
> Esa es una pregunta interesante.
> 
> Según la traducción de Google, "tuple" en inglés es "tupla" en español.
> Tambien consulté a Word Reference, donde hay una página dedicada a la
> palabra "tuple" en inglés [0 [1]], indicando que la palabra en español es
> "tupla".  Este hilo [1 [2]] en el foro de Word Reference (del 2007) indica
> que esta pregunta no se ha resuelto de manera conclusiva desde hace
> muchos años.  Tampoco no ayuda la cosa que la palabra "tupla" no ocurre
> en el DLE [2 [3]].
> 
> Tomando todo esto, me luce que lo mejor que hay en el momento es
> "tupla".
> 
> Saludos,
> 
> -Roberto
> 
> [0] https://www.wordreference.com/es/translation.asp?tranword=tuple
> [1] 
> https://forum.wordreference.com/threads/tuple-en-lenguajes-de-programacion.670067/
> [2] https://dle.rae.es/tupla?m=form

Encontré la etimología:

If we look at the etymology of the name tuple it is a generalisation to
denote any sequence of single, double, triple, quadruple, quintuple,
sextuple, septuple, octuple, ..., n‑tuple entries.

Por lo que es español, debería ser "tuple" también.
simple
doble
triple
cuádruple
quíntuple
séxtuple
...tuple...

Es una palabra inventada.

JAP

Para mezclar mas las cosas... Podríamos ver la "tupla" de python como
una matriz matemática con una sola fila, creo que es lo mas correcto ,
aquí metemos el temino "array" que en spanglish sería "arreglo" 

Saludos y disculpen la mezcolanza 

Links:
--
[1] https://www.wordreference.com/es/translation.asp?tranword=tuple
[2]
https://forum.wordreference.com/threads/tuple-en-lenguajes-de-programacion.670067/
[3] https://dle.rae.es/tupla?m=form

Re: OT - "tuples" en Python

2022-08-31 Thread Roberto C . Sánchez
On Wed, Aug 31, 2022 at 12:49:05PM -0300, Debian wrote:
> El 31/8/22 a las 12:35, Camaleón escribió:
> > Es correcto.
> > La RAE no alcanza términos científicos, hay que tirar de un corpus
> > especializdo;
> > 
> > https://enclavedeciencia.rae.es/tupla
> > 
> > Saludos,
> > 
> > -- Camaleón
> 
> No conocía esa posibilidad de entrada a la RAE.
> 
> 
Yo tampoco la conocía.

> (Cada vez me gusta más la RAE)
> 
A mi tambien.

Otro recurso de la RAE que descubrí el año pasado es: 
https://apps.rae.es/ntlle/SrvltGUILoginNtlle

Es útil para averiguar y entender como las palabras han cambiado (en
ortografía igual que en definición) desde el siglo XV (el diccionario
mas antiguo que está disponible en ese sitio es del 1495).

Saludos,

-Roberto
-- 
Roberto C. Sánchez



Re: OT - "tuples" en Python

2022-08-31 Thread Debian

El 31/8/22 a las 12:35, Camaleón escribió:

Es correcto.
La RAE no alcanza términos científicos, hay que tirar de un corpus
especializdo;

https://enclavedeciencia.rae.es/tupla

Saludos,

-- Camaleón


No conocía esa posibilidad de entrada a la RAE.


(Cada vez me gusta más la RAE)

JAP



Re: OT - "tuples" en Python

2022-08-31 Thread Roberto C . Sánchez
On Wed, Aug 31, 2022 at 12:32:43PM -0300, Debian wrote:
> El 31/8/22 a las 12:27, Roberto C. Sánchez escribió:
> > On Wed, Aug 31, 2022 at 12:18:39PM -0300, Debian wrote:
> > > Buen día.
> > > 
> > > Estoy aprendiendo Python. Y como no puede ser de otra manera, la
> > > bibliografía está en inglés, o spanglish.
> > > 
> > > Entiendo informáticamente lo que es "tuples" según el diccionario Oxford: 
> > > "a
> > > data structure consisting of multiple parts", o sea, una lista 
> > > consistente e
> > > inalterable.
> > > 
> > > Ahora bien; no encuentro la traducción al español en el DRAE.
> > > Se estaría usando una palabra "spanglish" que es "tupla".
> > > 
> > > ¿Es correcto este término, o hay alguno más específico?
> > > 
> > Esa es una pregunta interesante.
> > 
> > Según la traducción de Google, "tuple" en inglés es "tupla" en español.
> > Tambien consulté a Word Reference, donde hay una página dedicada a la
> > palabra "tuple" en inglés [0], indicando que la palabra en español es
> > "tupla".  Este hilo [1] en el foro de Word Reference (del 2007) indica
> > que esta pregunta no se ha resuelto de manera conclusiva desde hace
> > muchos años.  Tampoco no ayuda la cosa que la palabra "tupla" no ocurre
> > en el DLE [2].
> > 
> > Tomando todo esto, me luce que lo mejor que hay en el momento es
> > "tupla".
> > 
> > Saludos,
> > 
> > -Roberto
> > 
> > [0] https://www.wordreference.com/es/translation.asp?tranword=tuple
> > [1] 
> > https://forum.wordreference.com/threads/tuple-en-lenguajes-de-programacion.670067/
> > [2] https://dle.rae.es/tupla?m=form
> 
> Encontré la etimología:
> 
> If we look at the etymology of the name tuple it is a generalisation to
> denote any sequence of single, double, triple, quadruple, quintuple,
> sextuple, septuple, octuple, ..., n‑tuple entries.
> 
> Por lo que es español, debería ser "tuple" también.
> simple
> doble
> triple
> cuádruple
> quíntuple
> séxtuple
> ...tuple...
> 
> Es una palabra inventada.
> 
Eso tiene sentido.  Tambien busqué en francés y lo que me salió de eso
fue muy parecido.  Luce ser una palabra inventada en inglés que ha sido
prestada a otras idiomas.  Pero trato no llevarme mucho por el francés,
siendo el caso que en francés 'abogado' y 'aguacate' son la misma
palabra ;-)

Saludos,

-Roberto


-- 
Roberto C. Sánchez



Re: OT - "tuples" en Python

2022-08-31 Thread Camaleón
El 2022-08-31 a las 12:18 -0300, Debian escribió:

> Buen día.
> 
> Estoy aprendiendo Python. Y como no puede ser de otra manera, la
> bibliografía está en inglés, o spanglish.
> 
> Entiendo informáticamente lo que es "tuples" según el diccionario Oxford: "a
> data structure consisting of multiple parts", o sea, una lista consistente e
> inalterable.
> 
> Ahora bien; no encuentro la traducción al español en el DRAE.
> Se estaría usando una palabra "spanglish" que es "tupla".
> 
> ¿Es correcto este término, o hay alguno más específico?

Es correcto. 
La RAE no alcanza términos científicos, hay que tirar de un corpus 
especializdo;

https://enclavedeciencia.rae.es/tupla

Saludos,

-- 
Camaleón 



Re: OT - "tuples" en Python

2022-08-31 Thread Debian

El 31/8/22 a las 12:27, Roberto C. Sánchez escribió:

On Wed, Aug 31, 2022 at 12:18:39PM -0300, Debian wrote:

Buen día.

Estoy aprendiendo Python. Y como no puede ser de otra manera, la
bibliografía está en inglés, o spanglish.

Entiendo informáticamente lo que es "tuples" según el diccionario Oxford: "a
data structure consisting of multiple parts", o sea, una lista consistente e
inalterable.

Ahora bien; no encuentro la traducción al español en el DRAE.
Se estaría usando una palabra "spanglish" que es "tupla".

¿Es correcto este término, o hay alguno más específico?


Esa es una pregunta interesante.

Según la traducción de Google, "tuple" en inglés es "tupla" en español.
Tambien consulté a Word Reference, donde hay una página dedicada a la
palabra "tuple" en inglés [0], indicando que la palabra en español es
"tupla".  Este hilo [1] en el foro de Word Reference (del 2007) indica
que esta pregunta no se ha resuelto de manera conclusiva desde hace
muchos años.  Tampoco no ayuda la cosa que la palabra "tupla" no ocurre
en el DLE [2].

Tomando todo esto, me luce que lo mejor que hay en el momento es
"tupla".

Saludos,

-Roberto

[0] https://www.wordreference.com/es/translation.asp?tranword=tuple
[1] 
https://forum.wordreference.com/threads/tuple-en-lenguajes-de-programacion.670067/
[2] https://dle.rae.es/tupla?m=form


Encontré la etimología:

If we look at the etymology of the name tuple it is a generalisation to 
denote any sequence of single, double, triple, quadruple, quintuple, 
sextuple, septuple, octuple, ..., n‑tuple entries.


Por lo que es español, debería ser "tuple" también.
simple
doble
triple
cuádruple
quíntuple
séxtuple
...tuple...

Es una palabra inventada.


JAP



Re: OT - "tuples" en Python

2022-08-31 Thread Roberto C . Sánchez
On Wed, Aug 31, 2022 at 12:18:39PM -0300, Debian wrote:
> Buen día.
> 
> Estoy aprendiendo Python. Y como no puede ser de otra manera, la
> bibliografía está en inglés, o spanglish.
> 
> Entiendo informáticamente lo que es "tuples" según el diccionario Oxford: "a
> data structure consisting of multiple parts", o sea, una lista consistente e
> inalterable.
> 
> Ahora bien; no encuentro la traducción al español en el DRAE.
> Se estaría usando una palabra "spanglish" que es "tupla".
> 
> ¿Es correcto este término, o hay alguno más específico?
> 
Esa es una pregunta interesante.

Según la traducción de Google, "tuple" en inglés es "tupla" en español.
Tambien consulté a Word Reference, donde hay una página dedicada a la
palabra "tuple" en inglés [0], indicando que la palabra en español es
"tupla".  Este hilo [1] en el foro de Word Reference (del 2007) indica
que esta pregunta no se ha resuelto de manera conclusiva desde hace
muchos años.  Tampoco no ayuda la cosa que la palabra "tupla" no ocurre
en el DLE [2].

Tomando todo esto, me luce que lo mejor que hay en el momento es
"tupla".

Saludos,

-Roberto

[0] https://www.wordreference.com/es/translation.asp?tranword=tuple
[1] 
https://forum.wordreference.com/threads/tuple-en-lenguajes-de-programacion.670067/
[2] https://dle.rae.es/tupla?m=form
-- 
Roberto C. Sánchez



OT - "tuples" en Python

2022-08-31 Thread Debian

Buen día.

Estoy aprendiendo Python. Y como no puede ser de otra manera, la 
bibliografía está en inglés, o spanglish.


Entiendo informáticamente lo que es "tuples" según el diccionario 
Oxford: "a data structure consisting of multiple parts", o sea, una 
lista consistente e inalterable.


Ahora bien; no encuentro la traducción al español en el DRAE.
Se estaría usando una palabra "spanglish" que es "tupla".

¿Es correcto este término, o hay alguno más específico?

Muchas gracias.



Re: Questions Python

2022-08-30 Thread Marc Chantreux
salut Pierre,

On Tue, Aug 30, 2022 at 07:31:58PM +0200, Pierre ESTREM wrote:
>   widget = master.focus_get()
>    print(widget()) # Aucun retour

vraiment: je t'encourage à reposer la question sur le forum de l'afpy.

* ce tu trouveras des gens plus motivés et connaisseurs pour répondre à cette 
question
* je pense que ce genre de questions est vraiment hors sujet ici (en
  tout cas pour ma part je ne suis plus sur les listes python justement
  parce que ce langage me ... laisse dubitatif :))


bonne chance.

-- 
Marc Chantreux
Pôle de Calcul et Services Avancés à la Recherche (CESAR)
http://annuaire.unistra.fr/p/20200



Re: Questions Python

2022-08-30 Thread Pierre ESTREM

Bonjour,

La variable "widget" reçoit (pointe au sens de  C ?) l'objet qui a le 
focus (à ce stade je ne sais pas quel objet aurait ce focus).


""" Mon code

#!/usr/bin/env python3
# coding: utf-8

 from tkinter import *
from tkinter.ttk import *
import os

master = Tk()

def focus(event):
  widget = master.focus_get()
   print(widget()) # Aucun retour

"""

J'ai testé différentes propriétés mais j'obtiens uniquement la classe de 
l'objet (ou erreurs) et jamais le nom de la variable pointée.

Ca doit se faire ! :)

Pour ipython3 je vois cela, merci.

a+
pierre estrem


Le 30/08/2022 à 13:09, Marc Chantreux a écrit :

Bonjour Pierre,


Pour obtenir une liste des méthodes d'un objet de classe Canvas, je lis
qu'on peut exécuter :
print dir (Canvas())

c'est de la syntaxe python2 (ce qui me fait me demander quelle doc. tu
lis: vraiment, si tu n'as pas de code historique à gérer, oublie
python2).


J'obtiens une erreur ; quelle est la bonne syntaxe ?

c'était la bonne syntaxe... il y a longtemps. il faut maintenant mettre
des parenthèses autour des arguments de print.


D'autre part je ne trouve pas la méthode qui retourne le nom d'un widget
pointé mais j'obtiens son type, en faisant :
  print (widget)
L'instance widget a le focus et j'ai besoin de connaître son type, mais de
plus son petit nom (ex: listbox1, entry2 etc).

de quoi tu parles quand tu dis "le nom"? si c'est le nom de la variable
qui y fait référence dans ton programme (ce que je crois comprendre en lisant 
l'exemple),
ce soit etre possible en comparant le la référence à toutes les clefs du
namespace standard. je ne crois pas que python aie une fonction builtin
pour ca vu le peu d'intéret de la chose.


Merci de m'aider.

Avec plaisir. Je me permet 2 conseils:

* reposer ces questions aurprès des gens de l'afpy (ils avaient une
   liste de diffusion naguère mais ils ont une vision bien a eux de la
   modernité et sont passés sur discourse:https://discuss.afpy.org/):
   python est exactement le sujet de leurs fora, tu y trouveras des gens
   calés, passionnés et sympa.
* si tu souhaites explorer les objets, découvrir leurs methodes, les
   valeurs et tout ça (on appelle ça l'introspection), il existe ipython3
   qui devrait de faciliter la vie.

cordialement,





Re: Questions Python

2022-08-30 Thread Pierre ESTREM

Bonjour JF et le Monde,

Effectivement en Python3 il me fallait encadrer "dir" avec des parenthèses.
On obtient bien une liste des propriétés et méthodes de la classe passée 
en paramètre de "dir".


> Pour le widget, cela dépendpeut-être de sa nature; as-tu essayé:
>   print (widget())

Avec cette écriture, aucun retour.

a+

pierre estrem



Le 30/08/2022 à 09:47, Jean-François Colas a écrit :

Bonjour Pierre,

Avec Python 3, il faudra plutôt écrire:
   print (dir (Canvas))

La syntaxe que tu utilises pourrait être valide avec Python 2, en 
fonction de ce qu'est Canvas.


Pour le widget, cela dépendpeut-être de sa nature; as-tu essayé:
   print (widget())

J.-F.


Le 29/08/2022 à 23:14, Pierre ESTREM a écrit :

Bonjour la liste,

Dans mon apprentissage de Python, je progresse et sèche sur des points.

Pour obtenir une liste des méthodes d'un objet de classe Canvas, je 
lis qu'on peut exécuter :

   print dir (Canvas())

J'obtiens une erreur ; quelle est la bonne syntaxe ?

D'autre part je ne trouve pas la méthode qui retourne le nom d'un 
widget pointé mais j'obtiens son type, en faisant :

   print (widget)

L'instance widget a le focus et j'ai besoin de connaître son type, 
mais de plus son petit nom (ex: listbox1, entry2 etc).


Merci de m'aider.
--
Pierre ESTREM







Re: Questions Python

2022-08-30 Thread Jean-François Colas

Bonjour Pierre,

Avec Python 3, il faudra plutôt écrire:
   print (dir (Canvas))

La syntaxe que tu utilises pourrait être valide avec Python 2, en 
fonction de ce qu'est Canvas.


Pour le widget, cela dépendpeut-être de sa nature; as-tu essayé:
   print (widget())

J.-F.


Le 29/08/2022 à 23:14, Pierre ESTREM a écrit :

Bonjour la liste,

Dans mon apprentissage de Python, je progresse et sèche sur des points.

Pour obtenir une liste des méthodes d'un objet de classe Canvas, je lis 
qu'on peut exécuter :

   print dir (Canvas())

J'obtiens une erreur ; quelle est la bonne syntaxe ?

D'autre part je ne trouve pas la méthode qui retourne le nom d'un widget 
pointé mais j'obtiens son type, en faisant :

   print (widget)

L'instance widget a le focus et j'ai besoin de connaître son type, mais 
de plus son petit nom (ex: listbox1, entry2 etc).


Merci de m'aider.
--
Pierre ESTREM





Re: Questions Python

2022-08-30 Thread Marc Chantreux
Bonjour Pierre,

> Pour obtenir une liste des méthodes d'un objet de classe Canvas, je lis
> qu'on peut exécuter :
> print dir (Canvas())

c'est de la syntaxe python2 (ce qui me fait me demander quelle doc. tu
lis: vraiment, si tu n'as pas de code historique à gérer, oublie
python2).

> J'obtiens une erreur ; quelle est la bonne syntaxe ?

c'était la bonne syntaxe... il y a longtemps. il faut maintenant mettre
des parenthèses autour des arguments de print.

> D'autre part je ne trouve pas la méthode qui retourne le nom d'un widget
> pointé mais j'obtiens son type, en faisant :
>  print (widget)
> L'instance widget a le focus et j'ai besoin de connaître son type, mais de
> plus son petit nom (ex: listbox1, entry2 etc).

de quoi tu parles quand tu dis "le nom"? si c'est le nom de la variable
qui y fait référence dans ton programme (ce que je crois comprendre en lisant 
l'exemple),
ce soit etre possible en comparant le la référence à toutes les clefs du
namespace standard. je ne crois pas que python aie une fonction builtin
pour ca vu le peu d'intéret de la chose.

> Merci de m'aider.

Avec plaisir. Je me permet 2 conseils:

* reposer ces questions aurprès des gens de l'afpy (ils avaient une
  liste de diffusion naguère mais ils ont une vision bien a eux de la
  modernité et sont passés sur discourse: https://discuss.afpy.org/):
  python est exactement le sujet de leurs fora, tu y trouveras des gens
  calés, passionnés et sympa.
* si tu souhaites explorer les objets, découvrir leurs methodes, les
  valeurs et tout ça (on appelle ça l'introspection), il existe ipython3
  qui devrait de faciliter la vie.

cordialement,

-- 
Marc Chantreux
Pôle de Calcul et Services Avancés à la Recherche (CESAR)
http://annuaire.unistra.fr/p/20200



Re: Questions Python

2022-08-30 Thread Yahoo

Bonjour,

pour lister les méthodes d'une "class" en python3 il faut mettre dir 
dans les parenthèses


print(dir(Canvas))

Cdt

Loïc

Le 29/08/2022 à 23:14, Pierre ESTREM a écrit :

Bonjour la liste,

Dans mon apprentissage de Python, je progresse et sèche sur des points.

Pour obtenir une liste des méthodes d'un objet de classe Canvas, je 
lis qu'on peut exécuter :

  print dir (Canvas())

J'obtiens une erreur ; quelle est la bonne syntaxe ?

D'autre part je ne trouve pas la méthode qui retourne le nom d'un 
widget pointé mais j'obtiens son type, en faisant :

  print (widget)

L'instance widget a le focus et j'ai besoin de connaître son type, 
mais de plus son petit nom (ex: listbox1, entry2 etc).


Merci de m'aider.
--
Pierre ESTREM





Re: Questions Python

2022-08-30 Thread Sébastien NOBILI

Bonjour,

(Réponse partielle)

Le 2022-08-29 23:14, Pierre ESTREM a écrit :

Pour obtenir une liste des méthodes d'un objet de classe Canvas, je
lis qu'on peut exécuter :
  print dir (Canvas())


En Python 3 il faut mettre des parenthèses à "print". Ça n'est pas ça
ton erreur ?

Sébastien



Questions Python

2022-08-29 Thread Pierre ESTREM

Bonjour la liste,

Dans mon apprentissage de Python, je progresse et sèche sur des points.

Pour obtenir une liste des méthodes d'un objet de classe Canvas, je lis 
qu'on peut exécuter :

  print dir (Canvas())

J'obtiens une erreur ; quelle est la bonne syntaxe ?

D'autre part je ne trouve pas la méthode qui retourne le nom d'un widget 
pointé mais j'obtiens son type, en faisant :

  print (widget)

L'instance widget a le focus et j'ai besoin de connaître son type, mais 
de plus son petit nom (ex: listbox1, entry2 etc).


Merci de m'aider.
--
Pierre ESTREM



Tester un réseau en Python

2022-08-10 Thread Olivier
Bonjour,

J'ai souvent besoin de valider avant expédition et installation, le
fonctionnement de composants d'un réseau.
Parmi ces composants, j'ai toujours un serveur Debian qui fait office
de routeur et firewall.
J'ai aussi quelques routeurs, commutateurs et Rasbperries, sous Debian.
Ces derniers sont réservés aux tests.
Comme le serveur, les Rasbperries bénéficient d'une connexion hors
bande me permettant de les piloter depuis un PC tiers (sous debian) y
compris quand le réseau est mal configuré.

Plutôt de déclancher à la main des tests exécutés depuis des PC
connectés au réseau, j'aimerai exécuter sur une machine centrale un
programme unique qui va enchaîner pour moi tous les tests que j'aurai
rédigé, en s'appuyant si besoin sur les Rasbperries.
Chaque test pourra être du style:
- "depuis la machine en 192.168.1.67, vérifier que le ping avec
192.168.1.45 réussit"
- "depuis la machine en 192.168.1.67, vérifier que le ping avec
192.168.5.55 échoue et que le rejet est correctement loggué"
- "depuis la machine en 192.168.1.67, vérifier qu'avec la machine en
1.2.3.4, j'ai un upload/download supérieur à 1Mb/s/10Mb/s".

À terme, j'aurai besoin de tester l'accès à un portail WiFi
(redirection, acceptation de termes d'utilisation, ...).

Si possible, j'aimerai rédiger mes tests en Python.
Le framework pytest me paraît intéressant, (même si en survolant
rapidement sa liste interminable de plugins, je n'en ai pas vu qui
soit très indiqué pour le réseau).


Avez-vous déjà réaliser quelque chose d'approchant ?
Quels conseils et suggestions ?

Slts



  1   2   3   4   5   6   7   8   9   10   >