Re: Python 3.8 or later on Debian?

2024-09-19 Thread Mats Wichmann via Python-list

On 9/18/24 08:49, Ulrich Goebel via Python-list wrote:

Hi,

Debian Linux seems to love Python 3.7 - that is shown by apt-get list, and it's 
installed on my Debian Server.

But I need at least Python 3.8

Is there a repository which I can give to apt to get Python 3.8 or later?

Or do I really have to install and compile these versions manually? I'm not a 
friend of things so deep in the system...

Not going to pile on and tell you you must upgrade...

You can use a tool like pyenv to build Python IF another answer doesn't 
present itself - it how to build just about any version (not just 
cpython, but pypy, anaconda and more). The Real Python folks have 
written a fairly complete description (plus of course there's the 
project's own documentation):


https://realpython.com/intro-to-pyenv/


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


Re: Python 3.8 or later on Debian?

2024-09-18 Thread Thomas Passin via Python-list

On 9/18/2024 10:49 AM, Ulrich Goebel via Python-list wrote:

Hi,

Debian Linux seems to love Python 3.7 - that is shown by apt-get list, and it's 
installed on my Debian Server.

But I need at least Python 3.8

Is there a repository which I can give to apt to get Python 3.8 or later?

Or do I really have to install and compile these versions manually? I'm not a 
friend of things so deep in the system...


My Debian 12 VM has python 3.11.  You must have a very old version of 
Debian. On some VMs (not Debian, I think) I have had other Python 
versions alongside of the system's, e.g., 3.11 and 3.12. I didn't 
compile them myself. You will have to search for a repository with the 
right package.  But upgrade your system first!

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


Re: Python 3.8 or later on Debian?

2024-09-18 Thread dn via Python-list

On 19/09/24 02:49, Ulrich Goebel via Python-list wrote:

Hi,

Debian Linux seems to love Python 3.7 - that is shown by apt-get list, and it's 
installed on my Debian Server.

But I need at least Python 3.8

Is there a repository which I can give to apt to get Python 3.8 or later?

Or do I really have to install and compile these versions manually? I'm not a 
friend of things so deep in the system...



Assumptions:
1 "need" for a particular project, cf system-wide
2 use of a virtual-environment for project(s)


Try pyenv (https://github.com/pyenv/pyenv).

It offers a list of Python versions. When downloaded, it builds a 
version for you - assuming have build-environment s/w in place.

(this is where my lack of Debian knowledge may become obvious)

Thereafter, within the project's virtual-environment can select which 
(installed-version of) Python is to be used.


Am sure there are plenty of how-to-installs. Here's one:
https://bgasparotto.com/install-pyenv-ubuntu-debian

Am using pyenv to support multiple projects initially built during the 
reign of multiple Python versions (which now update annually - next is 
about two weeks away).


--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3.8 or later on Debian?

2024-09-18 Thread Alexander Neilson via Python-list
Python 3.7 is part of Buster (Debian old old stable)
If you moved to Debian bullseye you would get offered 3.9 (old stable)

Currently the stable version (Bookworm) would give you 3.11

I am not aware of anyone maintaining a repo for old Debian versions to get 
newer Python versions. But I know in the past I did build newer Python versions 
(mostly on raspberry pi’s)

Regards
Alexander

Alexander Neilson
Neilson Productions Limited
021 329 681
alexan...@neilson.net.nz

> On 19 Sep 2024, at 10:42, Ulrich Goebel via Python-list 
>  wrote:
> 
> Hi,
> 
> Debian Linux seems to love Python 3.7 - that is shown by apt-get list, and 
> it's installed on my Debian Server.
> 
> But I need at least Python 3.8
> 
> Is there a repository which I can give to apt to get Python 3.8 or later?
> 
> Or do I really have to install and compile these versions manually? I'm not a 
> friend of things so deep in the system...
> 
> Greetings
> Ulrich
> 
> --
> Ulrich Goebel 
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Python 3.8 or later on Debian?

2024-09-18 Thread Ulrich Goebel via Python-list
Hi,

Debian Linux seems to love Python 3.7 - that is shown by apt-get list, and it's 
installed on my Debian Server.

But I need at least Python 3.8

Is there a repository which I can give to apt to get Python 3.8 or later?

Or do I really have to install and compile these versions manually? I'm not a 
friend of things so deep in the system...

Greetings
Ulrich

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


Re: psycopg2 positioning of .commit() (Posting On Python-List Prohibited)

2024-09-11 Thread Jon Ribbens via Python-list
On 2024-09-11, Lawrence D'Oliveiro  wrote:
> On Tue, 10 Sep 2024 22:48:36 - (UTC), Jon Ribbens wrote:
>> But what if you tell it the wrong thing ...
>
> To get back to the original point of this thread, all that rigmarole to 
> try to ensure to call “rollback” in case of an exception is completely 
> unnecessary: the DBMS will take care of that for you.

No, it won't.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: psycopg2 positioning of .commit() (Posting On Python-List Prohibited)

2024-09-10 Thread Jon Ribbens via Python-list
On 2024-09-10, Lawrence D'Oliveiro  wrote:
> On Tue, 10 Sep 2024 08:38:30 - (UTC), Jon Ribbens wrote:
>
>> On 2024-09-09, Lawrence D'Oliveiro  wrote:
>>>
>>> On Mon, 9 Sep 2024 21:12:51 - (UTC), Jon Ribbens wrote:
>>>>
>>>> On 2024-09-09, Lawrence D'Oliveiro  wrote:
>>>>>
>>>>> On Mon, 9 Sep 2024 10:00:11 - (UTC), Jon Ribbens wrote:
>>>>>>
>>>>>> On 2024-09-09, Lawrence D'Oliveiro  wrote:
>>>>>>>
>>>>>>> The database only needs to commit when it is explicitly told.
>>>>>>> Anything less -- no commit.
>>>>>> 
>>>>>> So the Python code is half-way through a transaction when it throws
>>>>>> a (non-database-related) exception and that thread of execution is
>>>>>> aborted. The database connection returns to the pool ...
>>>>>
>>>>> The DBMS connection is deleted.
>>>> 
>>>> How does that happen then?
>>>
>>> You write code to do it.
>> 
>> Ok. So we've moved away from "In any DBMS worth its salt, rollback is
>> something that happens automatically" and now you're saying it isn't
>> automatic after all, "you write code to do it".
>
> The database code already performs that function. As far as the client is 
> concerned, the function happens automatically.

... but only if "you write code to do it".

> And it’s not just code, it’s data. The database structures on persistent 
> storage are also carefully designed with transaction safety in mind. So 
> any partial transaction data saved on persistent storage that remains 
> after a system crash can be identified as such and discarded, leaving the 
> database in its pre-transaction state.

Yes, nobody's disputing that. A good database will do what you tell it,
and keep the data you give it. But what if you tell it the wrong thing
or give it the wrong data? It's like, for example, a RAID array will
save you from a faulty disk, but will not save you from the software
writing incorrect data, which the RAID array will then faithfully copy
across to all the disks overwriting the good data.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: psycopg2 positioning of .commit() (Posting On Python-List Prohibited)

2024-09-10 Thread Jon Ribbens via Python-list
On 2024-09-10, Karsten Hilbert  wrote:
> Am Tue, Sep 10, 2024 at 08:38:30AM - schrieb Jon Ribbens via Python-list:
>> Ok. So we've moved away from "In any DBMS worth its salt, rollback is
>> something that happens automatically"
>
> Nope. The original post asked something entirely different.

No it didn't.

>> and now you're saying it isn't automatic after all,
>
> No again, such shenanigans only start to happen when pooling
> is brought into the equation.

No they don't.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: psycopg2 positioning of .commit() (Posting On Python-List Prohibited)

2024-09-10 Thread Karsten Hilbert via Python-list
Am Tue, Sep 10, 2024 at 08:38:30AM - schrieb Jon Ribbens via Python-list:

> Ok. So we've moved away from "In any DBMS worth its salt, rollback is
> something that happens automatically"

Nope. The original post asked something entirely different.

> and now you're saying it isn't automatic after all,

No again, such shenanigans only start to happen when pooling
is brought into the equation.

Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: psycopg2 positioning of .commit() (Posting On Python-List Prohibited)

2024-09-10 Thread Jon Ribbens via Python-list
On 2024-09-09, Lawrence D'Oliveiro  wrote:
> On Mon, 9 Sep 2024 21:12:51 - (UTC), Jon Ribbens wrote:
>> On 2024-09-09, Lawrence D'Oliveiro  wrote:
>>> On Mon, 9 Sep 2024 10:00:11 - (UTC), Jon Ribbens wrote:
>>>> On 2024-09-09, Lawrence D'Oliveiro  wrote:
>>>>> The database only needs to commit when it is explicitly told.
>>>>> Anything less -- no commit.
>>>> 
>>>> So the Python code is half-way through a transaction when it throws a
>>>> (non-database-related) exception and that thread of execution is
>>>> aborted. The database connection returns to the pool ...
>>>
>>> The DBMS connection is deleted.
>> 
>> How does that happen then?
>
> You write code to do it.

Ok. So we've moved away from "In any DBMS worth its salt, rollback is
something that happens automatically" and now you're saying it isn't
automatic after all, "you write code to do it". That was my point.
The database provides the tools, but it isn't psychic.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: psycopg2 positioning of .commit() (Posting On Python-List Prohibited)

2024-09-09 Thread Jon Ribbens via Python-list
On 2024-09-09, Lawrence D'Oliveiro  wrote:
> On Mon, 9 Sep 2024 10:00:11 - (UTC), Jon Ribbens wrote:
>> On 2024-09-09, Lawrence D'Oliveiro  wrote:
>>> The database only needs to commit when it is explicitly told. Anything
>>> less -- no commit.
>> 
>> So the Python code is half-way through a transaction when it throws a
>> (non-database-related) exception and that thread of execution is
>> aborted. The database connection returns to the pool ...
>
> The DBMS connection is deleted.

How does that happen then?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: psycopg2 positioning of .commit() (Posting On Python-List Prohibited)

2024-09-09 Thread Jon Ribbens via Python-list
On 2024-09-09, Karsten Hilbert  wrote:
> Am Mon, Sep 09, 2024 at 10:00:11AM - schrieb Jon Ribbens via Python-list:
>> So the Python code is half-way through a transaction when it throws
>> a (non-database-related) exception and that thread of execution is
>> aborted. The database connection returns to the pool,
>
> How does it return to the pool ?

It's just any circumstance in which a bit of your code uses a database
"cursor" (which isn't a cursor) that it didn't create moments before.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: psycopg2 positioning of .commit() (Posting On Python-List Prohibited)

2024-09-09 Thread Karsten Hilbert via Python-list
Am Mon, Sep 09, 2024 at 10:00:11AM - schrieb Jon Ribbens via Python-list:

> So the Python code is half-way through a transaction when it throws
> a (non-database-related) exception and that thread of execution is
> aborted. The database connection returns to the pool,

How does it return to the pool ?

Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: psycopg2 positioning of .commit() (Posting On Python-List Prohibited)

2024-09-09 Thread Karsten Hilbert via Python-list
Am Mon, Sep 09, 2024 at 10:00:11AM - schrieb Jon Ribbens via Python-list:

> > The database only needs to commit when it is explicitly told. Anything
> > less -- no commit.
>
> So the Python code is half-way through a transaction when it throws
> a (non-database-related) exception and that thread of execution is
> aborted. The database connection returns to the pool, and is re-used
> by another thread which continues using it to perform a different
> sequence of operations ... ending in a COMMIT, which commits
> one-and-a-half transactions.

Right, but that's true only when writable connections are
being pooled, which should be avoidable in many cases.

Any pool worth its salt should rollback any potentially
pending transactions of a connection when it is given back
that pooled connection. Unless explicitely told not to.

Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: psycopg2 positioning of .commit() (Posting On Python-List Prohibited)

2024-09-09 Thread Jon Ribbens via Python-list
On 2024-09-08, Lawrence D'Oliveiro  wrote:
> On Sun, 8 Sep 2024 11:03:21 - (UTC), Jon Ribbens wrote:
>> What if there's an exception in your exception handler? I'd put the
>> rollback in the 'finally' handler, so it's always called. If you've
>> already called 'commit' then the rollback does nothing of course.
>
> In any DBMS worth its salt, rollback is something that happens 
> automatically if the transaction should fail to complete for any reason.
>
> This applies for any failure reason, up to and including a program or 
> system crash.

If it's a program or system crash, sure, but anything less than that -
how would the database even know, unless the program told it?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: psycopg2 positioning of .commit() (Posting On Python-List Prohibited)

2024-09-09 Thread Jon Ribbens via Python-list
On 2024-09-09, Lawrence D'Oliveiro  wrote:
> On Mon, 9 Sep 2024 09:13:40 - (UTC), Jon Ribbens wrote:
>> On 2024-09-08, Lawrence D'Oliveiro  wrote:
>>> On Sun, 8 Sep 2024 11:03:21 - (UTC), Jon Ribbens wrote:
>>>> What if there's an exception in your exception handler? I'd put the
>>>> rollback in the 'finally' handler, so it's always called. If you've
>>>> already called 'commit' then the rollback does nothing of course.
>>>
>>> In any DBMS worth its salt, rollback is something that happens
>>> automatically if the transaction should fail to complete for any
>>> reason.
>>>
>>> This applies for any failure reason, up to and including a program or
>>> system crash.
>> 
>> If it's a program or system crash, sure, but anything less than that -
>> how would the database even know, unless the program told it?
>
> The database only needs to commit when it is explicitly told. Anything 
> less -- no commit.

So the Python code is half-way through a transaction when it throws
a (non-database-related) exception and that thread of execution is
aborted. The database connection returns to the pool, and is re-used
by another thread which continues using it to perform a different
sequence of operations ... ending in a COMMIT, which commits
one-and-a-half transactions.
-- 
https://mail.python.org/mailman/listinfo/python-list


[RELEASE] Python 3.13.0RC2, 3.12.6, 3.11.10, 3.10.15, 3.9.20, and 3.8.20 are now available!

2024-09-07 Thread Łukasz Langa via Python-list
Hi there!
A big joint release today. Mostly security fixes but we also have the final 
release candidate of 3.13 so let’s start with that!
Python 3.13.0RC2

Final opportunity to test and find any show-stopper bugs before we bless and 
release 3.13.0 final on October 1st.

Get it here: Python Release Python 3.13.0rc2 | Python.org 
<https://www.python.org/downloads/release/python-3130rc2/>
Call to action

We strongly encourage maintainers of third-party Python projects to prepare 
their projects for 3.13 compatibilities during this phase, and where necessary 
publish Python 3.13 wheels on PyPI to be ready for the final release of 3.13.0. 
Any binary wheels built against Python 3.13.0rc2 will work with future versions 
of Python 3.13. As always, report any issues to the Python bug tracker 
<https://github.com/python/cpython/issues>.

Please keep in mind that this is a preview release and while it’s as close to 
the final release as we can get it, its use is notrecommended for production 
environments.

Core developers: time to work on documentation now

Are all your changes properly documented?
Are they mentioned in What’s New 
<https://docs.python.org/3.13/whatsnew/3.13.html>?
Did you notice other changes you know of to have insufficient documentation?
As a reminder, until the final release of 3.13.0, the 3.13 branch is set up so 
that the Release Manager (@thomas <https://discuss.python.org/u/thomas>) has to 
merge the changes. Please add him (@Yhg1s on GitHub) to any changes you think 
should go into 3.13.0. At this point, unless something critical comes up, it 
should really be documentation only. Other changes (including tests) will be 
pushed to 3.13.1.

New features in Python 3.13

A new and improved interactive interpreter 
<https://docs.python.org/3.13/whatsnew/3.13.html#a-better-interactive-interpreter>,
 based on PyPy <https://pypy.org/>’s, featuring multi-line editing and color 
support, as well as colorized exception tracebacks 
<https://docs.python.org/3.13/whatsnew/3.13.html#improved-error-messages>.
An experimental free-threaded build mode 
<https://docs.python.org/3.13/whatsnew/3.13.html#free-threaded-cpython>, which 
disables the Global Interpreter Lock, allowing threads to run more 
concurrently. The build mode is available as an experimental feature in the 
Windows and macOS installers as well.
A preliminary, experimental JIT 
<https://docs.python.org/3.13/whatsnew/3.13.html#experimental-jit-compiler>, 
providing the ground work for significant performance improvements.
The locals() builtin function (and its C equivalent) now has well-defined 
semantics when mutating the returned mapping 
<https://docs.python.org/3.13/whatsnew/3.13.html#defined-mutation-semantics-for-locals>,
 which allows debuggers to operate more consistently.
The (cyclic) garbage collector is now incremental 
<https://docs.python.org/3.13/whatsnew/3.13.html#incremental-garbage-collection>,
 which should mean shorter pauses for collection in programs with a lot of 
objects.
A modified version of mimalloc <https://github.com/microsoft/mimalloc> is now 
included, optional but enabled by default if supported by the platform, and 
required for the free-threaded build mode.
Docstrings now have their leading indentation stripped 
<https://docs.python.org/3.13/whatsnew/3.13.html#other-language-changes>, 
reducing memory use and the size of .pyc files. (Most tools handling docstrings 
already strip leading indentation.)
The dbm module <https://docs.python.org/3.13/library/dbm.html> has a new 
dbm.sqlite3 backend <https://docs.python.org/3.13/whatsnew/3.13.html#dbm> that 
is used by default when creating new files.
The minimum supported macOS version was changed from 10.9 to 10.13 (High 
Sierra). Older macOS versions will not be supported going forward.
WASI is now a Tier 2 supported platform 
<https://peps.python.org/pep-0011/#tier-2>. Emscripten is no longer an 
officially supported platform 
<https://peps.python.org/pep-0011/#no-longer-supported-platforms> (but Pyodide 
<https://pyodide.org/>continues to support Emscripten).
iOS is now a Tier 3 supported platform <https://peps.python.org/pep-0730/>, 
with Android on the way as well <https://peps.python.org/pep-0738/>.
Python 3.12.6

This is an expedited release for 3.12 due to security content. The schedule 
returns back to regular programming in October.

One notable change for macOS users: as mentioned in the previous release of 
3.12, this release drops support for macOS versions 10.9 through 10.12. 
Versions of macOS older than 10.13 haven’t been supported by Apple since 2019, 
and maintaining support for them has become too difficult. (All versions of 
Python 3.13 have already dropped support for them.)

Get it here: Python Release Python 3.12.6 | Python.org 
<https://www.python.org/downloads/release/python-3126/>
92 commits.

Python 3.11.10

Pyth

Re: BitChan (python project)

2024-09-06 Thread Schimon Jehudah via Python-list
Greetings, 711!

This is very good!

Do you know of Plebbit?

It might be good to interoperate with Plebbit too.

https://plebbit.com/

Kind regards,
Schimon

On Thu, 5 Sep 2024 04:53:05 -
711 Spooky Mart via Python-list  wrote:

>  from https://github.com/813492291816/BitChan
> 
> BitChan is a decentralized anonymous imageboard inspired by BitBoard
> and built on top of Bitmessage with Tor, I2P, and GnuPG.
> 
> BitChan solves a number of security and free speech problems that have
> plagued most imageboards. Centralized imageboards can be taken offline
> or hijacked and can leak user data. BitChan reduces the likelihood of
> this by being decentralized, allowing each user to host their own
> instance of the software, requiring all connections to go through
> Tor/I2P, and not requiring JavaScript.
> 
> Users of centralized forums often have to deal with overzealous
> moderators and sometimes even pressure from state powers that tend to
> suffocate the forum's culture. BitChan's moderation is multifaceted,
> but to be brief, the option exists to create entirely unmoderatable
> boards to post content on. Due to its decentralized design, BitChan
> cannot be moderated by its developers, the government, or any other
> entity. Indeed, there is no way to disconnect BitChan from the
> internet, and as long as people are still running Bitmessage, BitChan
> is completely untouchable.
> 
> ─┏┓──┏━━┓───┏━━┓──Spooky Mart Channel
> ─┗━━┓─┃──┗┓─┃───┗┓─┃──[chan] 711
> ┃─┃──┏┛─┗┓──┏┛─┗┓─always open | stay spooky
> ┗━┛──┗━━━┛──┗━━━┛─https://bitmessage.org
> 
-- 
https://mail.python.org/mailman/listinfo/python-list


BitChan (python project)

2024-09-05 Thread 711 Spooky Mart via Python-list
 from https://github.com/813492291816/BitChan

BitChan is a decentralized anonymous imageboard inspired by BitBoard
and built on top of Bitmessage with Tor, I2P, and GnuPG.

BitChan solves a number of security and free speech problems that have
plagued most imageboards. Centralized imageboards can be taken offline
or hijacked and can leak user data. BitChan reduces the likelihood of
this by being decentralized, allowing each user to host their own
instance of the software, requiring all connections to go through
Tor/I2P, and not requiring JavaScript.

Users of centralized forums often have to deal with overzealous
moderators and sometimes even pressure from state powers that tend to
suffocate the forum's culture. BitChan's moderation is multifaceted,
but to be brief, the option exists to create entirely unmoderatable
boards to post content on. Due to its decentralized design, BitChan
cannot be moderated by its developers, the government, or any other
entity. Indeed, there is no way to disconnect BitChan from the
internet, and as long as people are still running Bitmessage, BitChan
is completely untouchable.

─┏┓──┏━━┓───┏━━┓──Spooky Mart Channel
─┗━━┓─┃──┗┓─┃───┗┓─┃──[chan] 711
┃─┃──┏┛─┗┓──┏┛─┗┓─always open | stay spooky
┗━┛──┗━━━┛──┗━━━┛─https://bitmessage.org

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


Re: Crash when launching python

2024-09-05 Thread Barry via Python-list



> On 5 Sep 2024, at 02:32, Greg Ewing via Python-list  
> wrote:
> 
> Normally it's in the .app/Contents/MacOS subdirectory. The name
> varies, but there's usually just one executable file in there. Run that
> from a shell and you should see anything written to stdout or stderr.

I recall that does not always work for app code that expects the macOS options 
that are passed in when launching from GUI.

Barry


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


Re: Crash when launching python

2024-09-04 Thread Greg Ewing via Python-list

On 5/09/24 7:48 am, Barry Scott wrote:

Beware that you cannot use print to stdout for a .app as its stdin/stdout do 
not go anywhere useful.


You can invoke the executable inside the package from the Terminal.

Normally it's in the .app/Contents/MacOS subdirectory. The name
varies, but there's usually just one executable file in there. Run that
from a shell and you should see anything written to stdout or stderr.

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


Re: Crash when launching python

2024-09-04 Thread Barry Scott via Python-list



> On 4 Sep 2024, at 16:27, Guenther Sohler via Python-list 
>  wrote:
> 
> Is it possible to turn on debugging and  to display on the console, where
> python is loading files from ?
> 

I assume you have a .app that is then packaged into a .dmg.

It will be the .app that you need to either build with a debug version of your 
code
or after building the .app edit the debug code into it.

Do you know that .app files are a tree of files?
You can right-click on an .app in Finder and it will have a "Show Package 
Context" option.

Or using the terminal and you can:
cd .app/Contents

then have a look around.

Beware that you cannot use print to stdout for a .app as its stdin/stdout do 
not go anywhere useful.
What I do is use code like this in the main function:

sys.stdout = open( '/home/barry/debug.log', 'w', 1 )
sys.stderr = sys.stdout 

Now you can use print(); look in the debug.log to see what happened.
Also any tracebacks will end up in the debug.log.

Barry

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


Re: Crash when launching python

2024-09-04 Thread dn via Python-list

On 5/09/24 03:27, Guenther Sohler via Python-list wrote:

Hi,

My "Project" is to integrate python support into OpenSCAD.  It runs quite
well, but
there are still issues on MacOS. On My MacOS it works, but it crashes when
I ship
the DMG files.
It looks very much like python is not able to find the "startup" python
files and therefore crashes.

Is it possible to turn on debugging and  to display on the console, where
python is loading files from ?



(am not a Mac user)

Starting with 'the basics', are you familiar with:
5. Using Python on a Mac https://docs.python.org/3/using/mac.html
(and the more general preceding sections)

This doc likely includes mention of such parameters:
1.2. Environment variables 
https://docs.python.org/3/using/cmdline.html#environment-variables


Here is a library for programmatic manipulation:
site — Site-specific configuration hook 
https://docs.python.org/3/library/site.html#module-site


Please let us know how things progress...

--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list


Crash when launching python

2024-09-04 Thread Guenther Sohler via Python-list
Hi,

My "Project" is to integrate python support into OpenSCAD.  It runs quite
well, but
there are still issues on MacOS. On My MacOS it works, but it crashes when
I ship
the DMG files.
It looks very much like python is not able to find the "startup" python
files and therefore crashes.

Is it possible to turn on debugging and  to display on the console, where
python is loading files from ?


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


RE: [Tutor] Getting a Process.start() error pickle.PicklingError: Can't pickle : it's not found as __builtin__.module with Python 2.7

2024-09-03 Thread AVI GROSS via Python-list
Unfortunately, Alan, even though 2.7 was considered pickled, people keep
taking it back out of the bottle and wondering why it does not work so well!

There are companies like Microsoft and Samsung that let people know their OS
on their devices will no longer be supported with updates and some apps may
no longer work if downloaded. And, yet, I bet for years afterwards, people
will refuse to upgrade because they don't want to replace equipment or even
learn a new slightly different interface.

Having said that, I understand many people are stuck for various reasons and
are required to use whatever version is officially allowed. For some
questions, answers may still be provided. There are some workarounds or even
newer packages designed to do what is not otherwise available.

But many of us here may not be answering the questions as we have no reason
to be able to access the old software or interest.

-Original Message-
From: Tutor  On Behalf Of
Alan Gauld via Tutor
Sent: Tuesday, September 3, 2024 4:41 AM
To: tu...@python.org
Cc: python-list@python.org
Subject: Re: [Tutor] Getting a Process.start() error pickle.PicklingError:
Can't pickle : it's not found as __builtin__.module with
Python 2.7

On 02/09/2024 15:00, marc nicole via Python-list wrote:
> Hello,
> 
> I am using Python 2.7 on Windows 10 

Others have pointed out that 2.7 is unsupported and has
been for many years now. Its also inferior in most
respects including its error reporting.
If possible you should upgrade to 3.X

> from multiprocessing import Process
> def do_something(text):
> print(text)
> if __name__ == "__main__":
> q = Process(target=do_something,args=("somecmd") )
> q.start()
> # following code should execute right after the q.start() call 

So what does happen? If you put a print statement here does it execute
before or after the error message? It might make things easier to
debug(clearer error traceback) if you put the code to create the thread
into a separate function?

def do_Something(text)...

def start(fn):
   q = Process
   q.start()

if __name_
   start(do_something)
   print('Something here')


> But getting the error at the call of Process().start():
> pickle.PicklingError: Can't pickle : it's not found as
> __builtin__.module

But please show us the full error trace even if its not much.

Also check your module naming, is there a possibility
you've named your file do_something.py or similar?
(I'm guessing the function is what is being pickled?)

> anybody could provide an alternative to call the function do_something()
in
> a separate thread ?

Why not just use the Threading module?
If it's as simple as just running something in a
thread multiprocessing is probably not needed.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos



___
Tutor maillist  -  tu...@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

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


Re: Getting a Process.start() error pickle.PicklingError: Can't pickle : it's not found as __builtin__.module with Python 2.7

2024-09-03 Thread geodandw via Python-list

On 9/2/24 11:36, Barry Scott wrote:




On 2 Sep 2024, at 15:00, marc nicole via Python-list  
wrote:

I am using Python 2.7 on Windows 10


Why? Install Python 3.12 and it will be easier to get help and support.
If you have legacy that still needs porting then you can install 3.12 along side
the unsupported 3.12.


Barry


I think you mean alongside the unsupported 2.7.
--
https://mail.python.org/mailman/listinfo/python-list


Python told me a Joke

2024-09-03 Thread Alan Bawden via Python-list
Python 3.10.5 (v3.10.5:f37715, Jul 10 2022, 00:26:17) [GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> x,_,z = [1,2,3]

Works as expected.

Now I didn't expect the following to work (but Python sometimes
surprises me!), so I tried:
 
>>> x,2,z = [1,2,3]
  File "", line 1
x,2,z = [1,2,3]
^^^
SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?

Yeah, that makes sense, no surprises today...  Except "maybe you meant
'=='..." caught my attention.  _Could_ that be what someone would want
in this situation I wondered?  So I tried:

>>> x,2,z == [1,2,3]
(1, 2, False)

Now that made me laugh.

- Alan

[ Some people reading this will be tempted to explain what's really
  going on here -- it's not hard to understand.  But please remember that
  a joke is never funny if you have to explain it. ]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python told me a Joke

2024-09-03 Thread Mild Shock via Python-list

You can try:

>>> 1,2 == 2,2
(1, True, 2)

Its the same as:

>>> 1, (2 == 2), 2
(1, True, 2)

Hope this helps!

Alan Bawden schrieb:

 Python 3.10.5 (v3.10.5:f37715, Jul 10 2022, 00:26:17) [GCC 4.9.2] on linux
 Type "help", "copyright", "credits" or "license" for more information.
 >>> x,_,z = [1,2,3]

Works as expected.

Now I didn't expect the following to work (but Python sometimes
surprises me!), so I tried:
  
 >>> x,2,z = [1,2,3]

   File "", line 1
 x,2,z = [1,2,3]
 ^^^
 SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?

Yeah, that makes sense, no surprises today...  Except "maybe you meant
'=='..." caught my attention.  _Could_ that be what someone would want
in this situation I wondered?  So I tried:

 >>> x,2,z == [1,2,3]
 (1, 2, False)

Now that made me laugh.

- Alan

[ Some people reading this will be tempted to explain what's really
   going on here -- it's not hard to understand.  But please remember that
   a joke is never funny if you have to explain it. ]



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


Re: [Tutor] Getting a Process.start() error pickle.PicklingError: Can't pickle : it's not found as __builtin__.module with Python 2.7

2024-09-03 Thread marc nicole via Python-list
Hello Alan,

Thanks for the reply, Here's the code I tested for the debug:

import time
from multiprocessing import Process

def do_Something():
print('hello world!')

def start(fn):
   p = Process(target=fn, args=())
   p.start()

def ghello():
print ("hello world g")

def fhello():
print('hello world f')

if __name__ == "__main__":
start(do_something)
print("executed")
exit(0)

but neither "Hello World" or "Executed" are displayed in the console which
finishes normally without returning any message.

Module naming is OK and don't think it is a problem related to that.

Now the question, when to use Process/Multiprocess and when to use
Threading in Python?.Thread is there a distinctive use case that can
showcase when to use either? are they interchangeable? to note that using
Threading the console DID display the messages correctly!

Thanks.

Le mar. 3 sept. 2024 à 10:48, Alan Gauld via Tutor  a
écrit :

> On 02/09/2024 15:00, marc nicole via Python-list wrote:
> > Hello,
> >
> > I am using Python 2.7 on Windows 10
>
> Others have pointed out that 2.7 is unsupported and has
> been for many years now. Its also inferior in most
> respects including its error reporting.
> If possible you should upgrade to 3.X
>
> > from multiprocessing import Process
> > def do_something(text):
> > print(text)
> > if __name__ == "__main__":
> > q = Process(target=do_something,args=("somecmd") )
> > q.start()
> > # following code should execute right after the q.start() call
>
> So what does happen? If you put a print statement here does it execute
> before or after the error message? It might make things easier to
> debug(clearer error traceback) if you put the code to create the thread
> into a separate function?
>
> def do_Something(text)...
>
> def start(fn):
>q = Process
>q.start()
>
> if __name_
>start(do_something)
>print('Something here')
>
>
> > But getting the error at the call of Process().start():
> > pickle.PicklingError: Can't pickle : it's not found as
> > __builtin__.module
>
> But please show us the full error trace even if its not much.
>
> Also check your module naming, is there a possibility
> you've named your file do_something.py or similar?
> (I'm guessing the function is what is being pickled?)
>
> > anybody could provide an alternative to call the function do_something()
> in
> > a separate thread ?
>
> Why not just use the Threading module?
> If it's as simple as just running something in a
> thread multiprocessing is probably not needed.
>
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
> http://www.amazon.com/author/alan_gauld
> Follow my photo-blog on Flickr at:
> http://www.flickr.com/photos/alangauldphotos
>
>
>
> ___
> Tutor maillist  -  tu...@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Getting a Process.start() error pickle.PicklingError: Can't pickle : it's not found as __builtin__.module with Python 2.7

2024-09-02 Thread Barry Scott via Python-list



> On 2 Sep 2024, at 15:00, marc nicole via Python-list  
> wrote:
> 
> I am using Python 2.7 on Windows 10

Why? Install Python 3.12 and it will be easier to get help and support.
If you have legacy that still needs porting then you can install 3.12 along side
the unsupported 3.12.


Barry

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


Getting a Process.start() error pickle.PicklingError: Can't pickle : it's not found as __builtin__.module with Python 2.7

2024-09-02 Thread marc nicole via Python-list
Hello,

I am using Python 2.7 on Windows 10 and I want to launch a process
independently of the rest of the code so that the execution continues while
the started process proceeds. I am using Process().start() from Python 2.7
as follows:

from multiprocessing import Process
def do_something(text):
print(text)
if __name__ == "__main__":
q = Process(target=do_something,args=("somecmd") )
q.start()
# following code should execute right after the q.start() call (not
until it returns)
.


But getting the error at the call of Process().start():
pickle.PicklingError: Can't pickle : it's not found as
__builtin__.module

anybody could provide an alternative to call the function do_something() in
a separate thread ?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Triggered By Mediocre Code (Posting On Python-List Prohibited)

2024-08-27 Thread Piergiorgio Sartor via Python-list

On 25/08/2024 23.53, Lawrence D'Oliveiro wrote:

Looking at this article about the top three languages for getting
programming jobs
<https://www.zdnet.com/article/want-a-programming-job-make-sure-you-learn-these-three-languages/>,
naturally I couldn’t help noticing the code in the screenshot at the
top (my transcription):

 bufferedNumber = str(doc.GetTime().GetFrame(docFps))
 if len(bufferedNumber)<4:
 for x in range(len(bufferedNumber),4):
 bufferedNumber = "0" + bufferedNumber

I mean, really? Four lines to do what could be done in a single
expression?

Was that written by a PHP programmer, do you think?


That the more correct question would be:
What is easier to read? And to debug?
The four line version or the one liner?

To paraphrase someone:
"If the length of a program would be
measured by the time needed to understand
it, some program would be too short to
be short."

Because the world is plenty of one liner
nobody (almost) doesn't understand.

There is even a category in the OCC
(https://www.ioccc.org/).

Don't get me wrong, I like and dislike
one liner.
Namely, I like mine and dislike the others :-)

bye,

--

piergiorgio

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


Re: Triggered By Mediocre Code (Posting On Python-List Prohibited)

2024-08-26 Thread rbowman via Python-list
On Sun, 25 Aug 2024 23:49:48 - (UTC), Lawrence D'Oliveiro wrote:

> The irony of my putdown is that PHP can do it about as simply. But don’t
> expect your typical PHP programmers to know that ...

It has had amazing longevity for something that was born as Personal Home 
Page. 
-- 
https://mail.python.org/mailman/listinfo/python-list


ANN: EmPy 4.2 -- a powerful, robust and mature templating system for Python

2024-08-25 Thread Erik Max Francis via Python-list

# EmPy 4.2 release announcement

I'm pleased to announce the release of EmPy 4.2.

The 4._x_ series is a modernization of the software and a revamp of
the EmPy system to update its feature set and make it more consistent
with the latest Python versions and practices.  EmPy 4._x_ was also
relicensed to BSD.

The 4._x_ series adds new markups, including inline comments,
backquote literals, chained if-then-else extended expression,
functional expressions, support for modern Pythonic controls,
stringized and multiline significators, disabling and re-enabling
output, named escapes, diacritics, icons, emojis, and customizable
extension markups.

It adds support for configuration objects (replacing options
dictionaries); native support for Unicode, file buffering, reference
counted `sys.stdout` proxies and error dispatchers and handlers; fixes
several serious bugs; has a set of full unit and system tests, an
extensive builtin help system; and the online documention has been
rewritten and expanded.  It also allows customizing the underlying
interpreter core and full support for EmPy modules -- EmPy documents
which can be imported as modules.

Attempts have been made to make EmPy 4._x_ as backward compatible as
is practical.  Most common markup has not changed; the only changes
being removal of `repr` (in favor of backquote literals) as well as
literal close parenthesis, bracket and brace markup; in-place markup
has changed syntax (to make way for emojis); and extension/custom
markup is now parsed more sensibly.

Most backward-incompatible changes are in the embedding interface.
The `Interpreter` constructor and global `expand` function now require
keyword arguments to prevent further backward compatibility problems,
though effort has been made to make the behavior as backward
compatible as possible.  The supported environment variables have
changed, as well as the filter, diversion and hook APIs, and options
dictionaries no longer exist (in deference to configurations).

For a comprehensive list of changes from 3._x_ to 4._x_, see:
<http://www.alcyone.com/software/empy/ANNOUNCE.html#changes>


## Introduction:  Welcome to EmPy!

[EmPy](http://www.alcyone.com/software/empy/) is a powerful, robust and 
mature

templating system for inserting Python code in template text.  EmPy
takes a source document, processes it, and produces output.  This is
accomplished via expansions, which are signals to the EmPy system
where to act and are indicated with markup.  Markup is set off by a
customizable prefix (by default the at sign, `@`).  EmPy can expand
arbitrary Python expressions, statements and control structures in
this way, as well as a variety of additional special forms.  The
remaining textual data is sent to the output, allowing Python to be
used in effect as a markup language.

EmPy also supports hooks, which can intercept and modify the behavior
of a running interpreter; diversions, which allow recording and
playback; filters, which are dynamic and can be chained together; and
a dedicated user-customizable callback markup.  The system is highly
configurable via command line options, configuration files, and
environment variables.  EmPy documents can also be imported as
modules, and an extensive API is also available for embedding EmPy
functionality in your own Python programs.

EmPy also has a supplemental library for additional non-essential
features (`emlib`), a documentation building library used to create
this documentation (`emdoc`), and an extensive help system (`emhelp`)
which can be queried from the command line with the main executable
`em.py` (`-h/--help`, `-H/--topics=TOPICS`).  The base EmPy
interpreter can function with only the `em.py`/`em` file/module
available.

EmPy can be used in a variety of roles, including as a templating
system, a text processing system (preprocessing and/or
postprocessing), a simple macro processor, a frontend for a content
management system, annotating documents, for literate programming, as
a souped-up text encoding converter, a text beautifier (with macros
and filters), and many other purposes.


### Markup overview

Expressions are embedded in text with the `@(...)` notation;
variations include conditional expressions with `@(...?...!...)`  and
the ability to handle thrown exceptions with `@(...$...)`.  As a
shortcut, simple variables and expressions can be abbreviated as
`@variable`, `@object.attribute`, `@sequence[index]`,
`@function(arguments...)`, `@function{markup}{...}` and
combinations.  Full-fledged statements are embedded with `@{...}`.
Control flow in terms of conditional or repeated expansion is
available with `@[...]`.  A `@` followed by any whitespace character
(including a newline) expands to nothing, allowing string
concatenations and line continuations.  Line comments are indicated
with `@#...` including the trailing newline.  `@*...*` allows inline
comments.  Output can be disabled and re-enabled with `@-...` and
`@+...`.  Escapes are ind

performance test on python with C API interface

2024-08-20 Thread aotto1968 via Python-list



I would like to present you with a performance test where Python performs very well in relation to the NHI1 project regarding 
the integration of Python into C.


 -> results: 
http://thedev.nhi1.de/theLink/main/md_docs_2main_2README__PERFORMANCE.htm#README_PERFORMANCE
 -> project: http://thedev.nhi1.de/NHI1/main/
--
https://mail.python.org/mailman/listinfo/python-list


[RELEASE] Python 3.12.5 released

2024-08-07 Thread Thomas Wouters via Python-list
Python 3.12.5 is now available:

https://www.python.org/downloads/release/python-3125/

This is the fifth maintenance release of Python 3.12

Python 3.12 is the newest major release of the Python programming language,
and it contains many new features and optimizations. 3.12.5 is the latest
maintenance release, containing more than 250 bugfixes, build improvements
and documentation changes since 3.12.4.

This version of Python 3.12 also comes with pip 24.2 by default. *However,
due to an incompatibility with older macOS versions, macOS 10.9 through
10.12 will downgrade their version of pip to 24.1.2 during the installation
process* (in the Install Certificates step). See the installer ReadMe and the
pip issue on the matter <https://github.com/pypa/pip/issues/12901> for more
information. Versions of macOS older than 10.13 haven’t been supported by
Apple since 2019, and maintaining support for them is becoming increasingly
difficult. While this release of 3.12 still supports them, *it is likely
that we will be forced to drop support for macOS 10.12 and older in a
future 3.12 release*. (Python 3.13 has already dropped support for them.)
<https://discuss.python.org/t/python-3-12-5-now-available/60219#p-182613-major-new-features-of-the-312-series-compared-to-311-2>Major
new features of the 3.12 series, compared to 3.11
<https://discuss.python.org/t/python-3-12-5-now-available/60219#p-182613-new-features-3>New
features

   - More flexible f-string parsing
   
<https://docs.python.org/3.12/whatsnew/3.12.html#pep-701-syntactic-formalization-of-f-strings>,
   allowing many things previously disallowed (PEP 701
   <https://peps.python.org/pep-0701/>).
   - Support for the buffer protocol
   
<https://docs.python.org/3.12/whatsnew/3.12.html#pep-688-making-the-buffer-protocol-accessible-in-python>
   in Python code (PEP 688 <https://peps.python.org/pep-0688/>).
   - A new debugging/profiling API
   
<https://docs.python.org/3.12/whatsnew/3.12.html#pep-669-low-impact-monitoring-for-cpython>
   (PEP 669 <https://peps.python.org/pep-0669/>).
   - Support for isolated subinterpreters
   
<https://docs.python.org/3.12/whatsnew/3.12.html#pep-684-a-per-interpreter-gil>
   with separate Global Interpreter Locks (PEP 684
   <https://peps.python.org/pep-0684>).
   - Even more improved error messages
   <https://docs.python.org/3.12/whatsnew/3.12.html#improved-error-messages>.
   More exceptions potentially caused by typos now make suggestions to the
   user.
   - Support for the Linux perf profiler
   <https://docs.python.org/3.12/howto/perf_profiling.html> to report
   Python function names in traces.
   - Many large and small performance improvements
   <https://docs.python.org/3.12/whatsnew/3.12.html#optimizations> (like PEP
   709 <https://peps.python.org/pep-0709/> and support for the BOLT binary
   optimizer), delivering an estimated 5% overall performance improvement.

<https://discuss.python.org/t/python-3-12-5-now-available/60219#p-182613-type-annotations-4>Type
annotations

   - New type annotation syntax
   
<https://docs.python.org/3.12/whatsnew/3.12.html#pep-695-type-parameter-syntax>
   for generic classes (PEP 695 <https://peps.python.org/pep-0695/>).
   - New override decorator
   
<https://docs.python.org/3.12/whatsnew/3.12.html#pep-698-override-decorator-for-static-typing>
   for methods (PEP 698 <https://peps.python.org/pep-0698>).

<https://discuss.python.org/t/python-3-12-5-now-available/60219#p-182613-deprecations-5>
Deprecations

   - The deprecated wstr and wstr_length members of the C implementation of
   unicode objects were removed, per PEP 623
   <https://peps.python.org/pep-0623/>.
   - In the unittest module, a number of long deprecated methods and
   classes were removed. (They had been deprecated since Python 3.1 or 3.2).
   - The deprecated smtpd and distutils modules have been removed (see PEP
   594 <https://peps.python.org/pep-0594/> and PEP 632
   <https://peps.python.org/pep-0632/>. The setuptools package continues to
   provide the distutils module.
   - A number of other old, broken and deprecated functions, classes and
   methods <https://docs.python.org/3.12/whatsnew/3.12.html#removed> have
   been removed.
   - Invalid backslash escape sequences in strings now warn with
   SyntaxWarning instead of DeprecationWarning, making them more visible.
   (They will become syntax errors in the future.)
   - The internal representation of integers has changed in preparation for
   performance enhancements. (This should not affect most users as it is an
   internal detail, but it may cause problems for Cython-generated code.)

For more details on the changes to Python 3.12, see What’s new in Python
3.12 <https://docs.python.org/3.12/whatsnew/3.12.html>.
<https://discuss.python.org/t/python-3-12-5-now-available/60219#p-182613-more-r

Re: Help needed - - running into issues with python and its tools

2024-08-06 Thread o1bigtenor via Python-list
On Tue, Aug 6, 2024 at 10:53 AM Bill Deegan 
wrote:

> I’m not looking through all the packages you have installed
>
> (Ctrl-F is your friend - - - )


> What version of python is installed on your system?
>
> There are actually 3 versions installed - - - which is why the whole list
was posted.
Your question was really not clear given the context.

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


Re: Issue bootstrapping Python - troubleshooting steps?

2024-08-06 Thread Barry Scott via Python-list



> On 6 Aug 2024, at 02:49, Piper McCorkle via Python-list 
>  wrote:
> 
> $ /tmp/sources/Python-3.12.4/configure --enable-shared --with-system-expat 
> --enable-optimizations --prefix=

I assume that you must provide a value for --prefix. The linux default would be 
--prefix=/usr

Barry

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


Re: python C-api and thread

2024-08-06 Thread Barry Scott via Python-list



> On 6 Aug 2024, at 07:11, aotto1968 via Python-list  
> wrote:
> 
> I know but I use a thread like a process because the "conversation" between 
> the threads is done by my
> software. a Thread is usually faster to startup (thread-pool) this mean for 
> high-load this is
> significant faster even than fork.

using processes means you are more robust and can survive a process crash.
using async, assuming you do enough I/O, will out perform threads.

Barry

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


Re: python C-api and thread

2024-08-06 Thread aotto1968 via Python-list

On 06.08.24 04:34, Grant Edwards wrote:

On 2024-08-05, aotto1968 via Python-list  wrote:


Is it possible to run two completely independent Python interpreters
in one process, each using a thread?

By independent, I mean that no data is shared between the
interpreters and thus the C API can be used without any other
"lock/GIL" etc.


No, not using any OS I've ever seen. The usual definition of "threads"
is that they share data, and the definition of "processes" is that
processes don't share data.

How exactly does what you're trying to do differ from runnig two
Python interpreters in two processes?

--
Grant





I know but I use a thread like a process because the "conversation" between the 
threads is done by my
software. a Thread is usually faster to startup (thread-pool) this mean for 
high-load this is
significant faster even than fork.
--
https://mail.python.org/mailman/listinfo/python-list


Re: python C-api and thread (Posting On Python-List Prohibited)

2024-08-06 Thread aotto1968 via Python-list

On 06.08.24 02:32, Lawrence D'Oliveiro wrote:

On Mon, 5 Aug 2024 23:19:14 +0200, aotto1968 wrote:


Is it possible to run two completely independent Python interpreters in
one process, each using a thread?

By independent, I mean that no data is shared between the interpreters
and thus the C API can be used without any other "lock/GIL" etc.


Seems like yes
<https://docs.python.org/3/c-api/init.html#c.Py_NewInterpreterFromConfig>.


→ I think that could be a solution.
--
https://mail.python.org/mailman/listinfo/python-list


Re: Help needed - - running into issues with python and its tools

2024-08-06 Thread Bill Deegan via Python-list
I’m not looking through all the packages you have installed

What version of python is installed on your system?


On Tue, Aug 6, 2024 at 5:24 AM o1bigtenor  wrote:

>
>
> On Mon, Aug 5, 2024 at 10:36 PM Bill Deegan 
> wrote:
>
>> why reply to me instead of to the list?
>> It's generally considered bad form to do so.
>>
>
> Got it - - - except this list wants only reply all the next one wants only
> reply and
> keeping straight which is which isn't always happening. I did apologize
> and asked
> you to advise in the next one whether you even wanted to be included
> (which you haven't
> responded to).
>
>>
>>
>> Do you have any python 3 installed on your system?
>> Or python 2.7?
>> If not, can you install such via system package?
>>
>
>
>  # dpkg -l | grep python*
> ii  2to3   3.11.2-1
>   all  2to3 binary using python3
> ii  idle-python3.113.11.2-6+deb12u2
>   all  IDE for Python (v3.11) using Tkinter
> ii  ipython3   8.5.0-4
>  all  Enhanced interactive Python 3 shell
> ii  libboost-python1.74.0  1.74.0+ds1-21
>  amd64Boost.Python Library
> ii  libpython3-all-dev:amd64   3.11.2-1+b1
>  amd64package depending on all supported Python 3
> development packages
> ii  libpython3-dev:amd64   3.11.2-1+b1
>  amd64header files and a static library for Python
> (default)
> ii  libpython3-stdlib:amd643.11.2-1+b1
>  amd64interactive high-level object-oriented language
> (default python3 version)
> rc  libpython3.10-minimal:amd643.10.9-1
>   amd64Minimal subset of the Python language (version
> 3.10)
> ii  libpython3.11:amd643.11.2-6+deb12u2
>   amd64Shared Python runtime library (version 3.11)
> ii  libpython3.11-dev:amd643.11.2-6+deb12u2
>   amd64Header files and a static library for Python
> (v3.11)
> ii  libpython3.11-minimal:amd643.11.2-6+deb12u2
>   amd64Minimal subset of the Python language (version
> 3.11)
> ii  libpython3.11-stdlib:amd64 3.11.2-6+deb12u2
>   amd64Interactive high-level object-oriented language
> (standard library, version 3.11)
> ii  libpython3.11-testsuite    3.11.2-6+deb12u2
>   all  Testsuite for the Python standard library (v3.11)
> ii  libpython3.9-minimal:amd64 3.9.13-1
>   amd64Minimal subset of the Python language (version
> 3.9)
> ii  libpython3.9-stdlib:amd64  3.9.13-1
>   amd64Interactive high-level object-oriented language
> (standard library, version 3.9)
> ii  python-apsw-doc    3.40.0.0-2
>   all  documentation for python-apsw
> ii  python-apt-common  2.6.0
>  all  Python interface to libapt-pkg (locales)
> ii  python-apt-common-devuan   2.5.3devuan2
>   all  Templates for aptitude
> ii  python-attr-doc        22.2.0-1
>   all  documentation for the attrs Python library
> ii  python-babel-localedata2.10.3-1
>   all  tools for internationalizing Python applications
> - locale data files
> ii  python-cryptography-doc        38.0.4-3
>   all  Python library exposing cryptographic recipes
> and primitives (documentation)
> ii  python-cycler-doc  0.11.0-1
>   all      composable kwarg iterator (documentation)
> ii  python-gmpy2-common2.1.2-2
>  all  common files for python3-gmpy2
> ii  python-ipython-doc 8.5.0-4
>  all  Enhanced interactive Python shell (documentation)
> ii  python-markdown-doc3.4.1-2
>      all  text-to-HTML conversion library/tool
> (documentation)
> ii  python-matplotlib-data 3.6.3-1
>  all  Python based plotting system (data package)
> ii  python-matplotlib-doc  3.5.2-4
>  all  Python based plotting system (documentation
> package)
> ii  python-m

Re: Help needed - - running into issues with python and its tools

2024-08-06 Thread o1bigtenor via Python-list
On Mon, Aug 5, 2024 at 10:36 PM Bill Deegan 
wrote:

> why reply to me instead of to the list?
> It's generally considered bad form to do so.
>

Got it - - - except this list wants only reply all the next one wants only
reply and
keeping straight which is which isn't always happening. I did apologize and
asked
you to advise in the next one whether you even wanted to be included (which
you haven't
responded to).

>
>
> Do you have any python 3 installed on your system?
> Or python 2.7?
> If not, can you install such via system package?
>


 # dpkg -l | grep python*
ii  2to3   3.11.2-1
all  2to3 binary using python3
ii  idle-python3.113.11.2-6+deb12u2
all  IDE for Python (v3.11) using Tkinter
ii  ipython3   8.5.0-4
     all  Enhanced interactive Python 3 shell
ii  libboost-python1.74.0  1.74.0+ds1-21
 amd64Boost.Python Library
ii  libpython3-all-dev:amd64   3.11.2-1+b1
 amd64    package depending on all supported Python 3
development packages
ii  libpython3-dev:amd64   3.11.2-1+b1
 amd64header files and a static library for Python
(default)
ii  libpython3-stdlib:amd643.11.2-1+b1
 amd64interactive high-level object-oriented language
(default python3 version)
rc  libpython3.10-minimal:amd643.10.9-1
    amd64Minimal subset of the Python language (version
3.10)
ii  libpython3.11:amd643.11.2-6+deb12u2
amd64Shared Python runtime library (version 3.11)
ii  libpython3.11-dev:amd643.11.2-6+deb12u2
amd64Header files and a static library for Python
(v3.11)
ii  libpython3.11-minimal:amd643.11.2-6+deb12u2
    amd64Minimal subset of the Python language (version
3.11)
ii  libpython3.11-stdlib:amd64 3.11.2-6+deb12u2
amd64Interactive high-level object-oriented language
(standard library, version 3.11)
ii  libpython3.11-testsuite3.11.2-6+deb12u2
    all  Testsuite for the Python standard library (v3.11)
ii  libpython3.9-minimal:amd64 3.9.13-1
    amd64Minimal subset of the Python language (version 3.9)
ii  libpython3.9-stdlib:amd64  3.9.13-1
amd64Interactive high-level object-oriented language
(standard library, version 3.9)
ii  python-apsw-doc3.40.0.0-2
    all      documentation for python-apsw
ii  python-apt-common  2.6.0
 all  Python interface to libapt-pkg (locales)
ii  python-apt-common-devuan   2.5.3devuan2
    all  Templates for aptitude
ii  python-attr-doc22.2.0-1
    all  documentation for the attrs Python library
ii  python-babel-localedata2.10.3-1
all      tools for internationalizing Python applications -
locale data files
ii  python-cryptography-doc    38.0.4-3
all  Python library exposing cryptographic recipes and
primitives (documentation)
ii  python-cycler-doc  0.11.0-1
all  composable kwarg iterator (documentation)
ii  python-gmpy2-common2.1.2-2
 all      common files for python3-gmpy2
ii  python-ipython-doc 8.5.0-4
     all  Enhanced interactive Python shell (documentation)
ii  python-markdown-doc3.4.1-2
 all  text-to-HTML conversion library/tool
(documentation)
ii  python-matplotlib-data     3.6.3-1
 all  Python based plotting system (data package)
ii  python-matplotlib-doc      3.5.2-4
 all  Python based plotting system (documentation
package)
ii  python-mpmath-doc  1.2.1-2
 all  library for arbitrary-precision floating-point
arithmetic - Documentation
ii  python-numpy-doc   1:1.23.5-2
    all  NumPy documentation
ii  python-pexpect-doc     4.8.0-4
 all  Python module for automating interactive
applications (documentation)
ii  python-pil-doc 9.4.0-1.1+deb12u1
     all  Examples for the Python Imaging Library
ii  python-pygments-doc2.14.0+dfsg-1
 all      documenta

Issue bootstrapping Python - troubleshooting steps?

2024-08-05 Thread Piper McCorkle via Python-list
Hi!

I'm working on a Linux From Scratch sort of system, and part of that is 
bootstrapping Python. I'm running into an error message in the compilation 
though - could anyone help me with next steps on troubleshooting the error?

Error:

> ./_bootstrap_python /tmp/sources/Python-3.12.4/Programs/_freeze_module.py abc 
> /tmp/sources/Python-3.12.4/Lib/abc.py Python/frozen_modules/abc.h
> Fatal Python error: init_import_site: Failed to import the site module
> Python runtime state: initialized
> Traceback (most recent call last):
>   File "/tmp/sources/Python-3.12.4/Lib/site.py", line 80, in 
> PREFIXES = [sys.prefix, sys.exec_prefix]
> ^^
> AttributeError: module 'sys' has no attribute 'prefix'
> make[2]: *** [Makefile:1329: Python/frozen_modules/abc.h] Error 1

I'm essentially trying to build Python with the following commands:
$ cd /tmp/build/Python
$ /tmp/sources/Python-3.12.4/configure --enable-shared --with-system-expat 
--enable-optimizations --prefix=
$ make
$ make install

I'm building Python 3.12.4.
$ sha256sum sources/Python-3.12.4.tar.xz
f6d419a6d8743ab26700801b4908d26d97e8b986e14f95de31b32de2b0e79554  
sources/Python-3.12.4.tar.xz

I've attached a complete build log. If you need any more information in order 
to help me, please feel free to ask! I'd appreciate if you can CC me on any 
replies, so that they end up in my inbox instead of in the mailing list digest.

Piper McCorkle (https://piperswe.me)
cont...@piperswe.me | +1 (508) 493-8615
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help needed - - running into issues with python and its tools

2024-08-05 Thread Bill Deegan via Python-list
why reply to me instead of to the list?
It's generally considered bad form to do so.


Do you have any python 3 installed on your system?
Or python 2.7?
If not, can you install such via system package?

-Bill



On Mon, Aug 5, 2024 at 6:06 PM o1bigtenor  wrote:

>
>
> On Mon, Aug 5, 2024 at 5:28 PM Bill Deegan via Python-list <
> python-list@python.org> wrote:
>
>> Did Mats suggestion of:
>> python3.13 -m venv new_venv
>> $ new_venv/bin/python --version
>> Python 3.13.0b4
>> $ source new_venv/bin/activate
>>
>> Not work?
>> That should work on any system, with any system installl python.
>> It's not trying to modify the system installed python in anyway...
>>
>> If not, please paste the error output you're getting.
>>
>
>  # python3.13 -m venv new_venv
> -bash: python3.13: command not found
>
> $ python3.13 -m venv new_venv
> bash: python3.13: command not found
>
> There you have it - - - the first one run as superuser and the second as
> usr.
>
> Regards
>
>
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python C-api and thread

2024-08-05 Thread Chris Angelico via Python-list
On Tue, 6 Aug 2024 at 08:48, aotto1968 via Python-list
 wrote:
>
> hi,
>
> Is it possible to run two completely independent Python interpreters in one 
> process, each using a thread?
>
> By independent, I mean that no data is shared between the interpreters and 
> thus the C API can be used without any other
> "lock/GIL" etc.
>

You're probably thinking of subinterpreters:

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

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


Re: python C-api and thread

2024-08-05 Thread Grant Edwards via Python-list
On 2024-08-05, aotto1968 via Python-list  wrote:

> Is it possible to run two completely independent Python interpreters
> in one process, each using a thread?
>
> By independent, I mean that no data is shared between the
> interpreters and thus the C API can be used without any other
> "lock/GIL" etc.

No, not using any OS I've ever seen. The usual definition of "threads"
is that they share data, and the definition of "processes" is that
processes don't share data.

How exactly does what you're trying to do differ from runnig two
Python interpreters in two processes?

--
Grant



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


python C-api and thread

2024-08-05 Thread aotto1968 via Python-list

hi,

Is it possible to run two completely independent Python interpreters in one 
process, each using a thread?

By independent, I mean that no data is shared between the interpreters and thus the C API can be used without any other 
"lock/GIL" etc.


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


Re: Help needed - - running into issues with python and its tools

2024-08-05 Thread Bill Deegan via Python-list
Did Mats suggestion of:
python3.13 -m venv new_venv
$ new_venv/bin/python --version
Python 3.13.0b4
$ source new_venv/bin/activate

Not work?
That should work on any system, with any system installl python.
It's not trying to modify the system installed python in anyway...

If not, please paste the error output you're getting.


On Mon, Aug 5, 2024 at 3:13 PM Mats Wichmann via Python-list <
python-list@python.org> wrote:

> On 8/5/24 15:17, o1bigtenor via Python-list wrote:
>
> >> That's something like
> >>
> >> pyenv install 3.12.4
> >>
> >
> > $ pyenv install 3.12.4
> > bash: pyenv: command not found
> >
>
> > pyenv is not a 'global' package
> >
> > there is a mountain of /root/.pyenv  files though
> > there is also quite a number of /root/.pyenv/plugins/pyenv-virtualenv/
> > files
> >
> > when looking in the /root/.pyenv files I can find options for all the
> older
> > version of python
> > but none for anything newer than what is on my system
> >
> > is there something else to install to achieve this 'version freedom' that
> > pyenv promises?
>
> It has to go somewhere your shell can find it.  Mine is a shell
> function, but it was set up so many years ago I don't remember details.
> It's presumably the pyenv installation instructions...
>
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help needed - - running into issues with python and its tools

2024-08-05 Thread Mats Wichmann via Python-list

On 8/5/24 15:17, o1bigtenor via Python-list wrote:


That's something like

pyenv install 3.12.4



$ pyenv install 3.12.4
bash: pyenv: command not found




pyenv is not a 'global' package

there is a mountain of /root/.pyenv  files though
there is also quite a number of /root/.pyenv/plugins/pyenv-virtualenv/
files

when looking in the /root/.pyenv files I can find options for all the older
version of python
but none for anything newer than what is on my system

is there something else to install to achieve this 'version freedom' that
pyenv promises?


It has to go somewhere your shell can find it.  Mine is a shell 
function, but it was set up so many years ago I don't remember details. 
It's presumably the pyenv installation instructions...




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


Re: Help needed - - running into issues with python and its tools

2024-08-05 Thread o1bigtenor via Python-list
On Mon, Aug 5, 2024 at 3:56 PM Mats Wichmann  wrote:

>
> > On Mon, Aug 5, 2024 at 8:51 AM Mats Wichmann  > <mailto:m...@wichmann.us>> wrote:
> >
> > On 8/5/24 06:48, o1bigtenor via Python-list wrote:
> >  > On Sun, Aug 4, 2024 at 8:49 AM Mats Wichmann via Python-list <
> >  > python-list@python.org <mailto:python-list@python.org>> wrote:
> >  >
> >  >> On 8/3/24 20:03, o1bigtenor via Python-list wrote:
> >  >>
> >  >>> My question was, is and will be (and the doc absolutely doesn't
> > cover it)
> >  >>> how do I install a different version in the venv so that python
> > 3.11.x on
> >  >>> the
> >  >>> system is not discombobulated by the python 3.12.x in the venv.
> >  >>> That python 3.12 would let me run the tools needed.
> >  >>> (Its the how to install the next version of python that I just
> > haven't
> >  >> been
> >  >>> able to find information on - - - and I would be looking for
> > information
> >  >>> on how to install on a *nix.)
> >  >>
> >  >> To get a different Python "in" the venv, you use the version you
> > want in
> >  >> the construction of the venv. For example:
> >  >>
> >  >>
> >  >> $ python3.13 -m venv new_venv
> >  >> $ new_venv/bin/python --version
> >  >> Python 3.13.0b4
> >  >> $ source new_venv/bin/activate
> >  >>
> >  >>
> >  >   "https://peps.python.org/pep-0668/
> > <https://peps.python.org/pep-0668/> PEP 668, which prevents pip from
> >  > interacting with the OS installed python. This change has been
> > done in red
> >  > hat and other distros too . . . "
> >  >
> >  > similarly your first command produces and error code for the same
> > reason.
> >  >
> >  > Sorry - - - not my policy - - -
> >
> > What? Yes, the *system* pip should have some restrictions, if it's a
> > system mainly managed by a package manager.
> >
> > Setting up a venv is the *expected* approach to such situations, and
> > creating one doesn't cause any problems. You end up with a pip in the
> > activated venv that's going to install to a different path (the one
> in
> > the venv), and will not be marked as externally managed, as the
> package
> > manager has no control over that path.
> >
> > That's the whole point.  What error are you getting?  The venv
> > module is
> > not the pip module so restrictions on the system pip have nothing to
> do
> > with it.
> >
> > set up pyenv
> > activated a venv
> > trying to install python3.12 into it
> >
> > 1. download of python3.12 (blahblahblahetc).deb will not install
> > 2. download of python3.12.tar.xz similarly will not install
> >
> > (venv2) memyself@devuanbigbox:~$ pip install
> > /home/memyself/Downloads/Python-3.12.4.tar.xz
> > Processing ./Downloads/Python-3.12.4.tar.xz
> > ERROR: file:///home/memyself/Downloads/Python-3.12.4.tar.xz does not
> > appear to be a Python project: neither 'setup.py' nor 'pyproject.toml'
> > found.
> >
> > seems that I need a different version (installable as it were) of
> > python3.12
> > or my approach is all wrong!
>
>
> you can't install Python "into" a venv.
>
> you use a version of Python as the base when *creating* a venv, the venv
> will use the same binary as the base python (symlinks if possible, as in
> the Linux case), but with different paths.
>
> Since you've already got pyenv, use it to build the version you want to
> use - I think you said there wasn't a deb for 3.12 in your distro?
>

correct


> That's something like
>
> pyenv install 3.12.4
>

$ pyenv install 3.12.4
bash: pyenv: command not found


>
> that will use the build recipe it has... and hopefully work.  Distro
> Pythons sometimes have some strange setups that are hard to reproduce.
> Pyenv knows how to build micropython, too, should it ever come to that.
>
> If you indeed found a deb for the right Python, use apt to install it,
> and then use *that* Python to create your venv.
>
> If you have the pyenv-virtualenv plugin, you can ask it to make the
> virtualenv for you, if pyenv built the Python
>
>
pyenv is not a 'global' package

there is a mountain of /root/.pyenv  files though
there is also quite a number of /root/.pyenv/plugins/pyenv-virtualenv/
files

when looking in the /root/.pyenv files I can find options for all the older
version of python
but none for anything newer than what is on my system

is there something else to install to achieve this 'version freedom' that
pyenv promises?

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


Re: Help needed - - running into issues with python and its tools

2024-08-05 Thread o1bigtenor via Python-list
On Mon, Aug 5, 2024 at 3:55 PM Bill Deegan 
wrote:

> Your approach is wrong.
> You don't build python from source using pip.
>
> You don't install new versions of python into a venv either.
>
> Have you read the following?
> https://docs.micropython.org/en/latest/esp8266/tutorial/intro.html
>
> That seems to have instructions for what you want to do..
>

See item 1.4 - - - - that's where I'm at (and that's where the problems
are hidden at as well!)

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


Re: Help needed - - running into issues with python and its tools

2024-08-05 Thread Mats Wichmann via Python-list

On 8/5/24 14:39, o1bigtenor wrote:
Matt - if you would rather that you were not included in the address 
list - -

please advise.

On Mon, Aug 5, 2024 at 8:51 AM Mats Wichmann <mailto:m...@wichmann.us>> wrote:


On 8/5/24 06:48, o1bigtenor via Python-list wrote:
 > On Sun, Aug 4, 2024 at 8:49 AM Mats Wichmann via Python-list <
 > python-list@python.org <mailto:python-list@python.org>> wrote:
 >
 >> On 8/3/24 20:03, o1bigtenor via Python-list wrote:
 >>
 >>> My question was, is and will be (and the doc absolutely doesn't
cover it)
 >>> how do I install a different version in the venv so that python
3.11.x on
 >>> the
 >>> system is not discombobulated by the python 3.12.x in the venv.
 >>> That python 3.12 would let me run the tools needed.
 >>> (Its the how to install the next version of python that I just
haven't
 >> been
 >>> able to find information on - - - and I would be looking for
information
 >>> on how to install on a *nix.)
 >>
 >> To get a different Python "in" the venv, you use the version you
want in
 >> the construction of the venv. For example:
 >>
 >>
 >> $ python3.13 -m venv new_venv
 >> $ new_venv/bin/python --version
 >> Python 3.13.0b4
 >> $ source new_venv/bin/activate
 >>
 >>
 >   "https://peps.python.org/pep-0668/
<https://peps.python.org/pep-0668/> PEP 668, which prevents pip from
 > interacting with the OS installed python. This change has been
done in red
 > hat and other distros too . . . "
 >
 > similarly your first command produces and error code for the same
reason.
 >
 > Sorry - - - not my policy - - -

What? Yes, the *system* pip should have some restrictions, if it's a
system mainly managed by a package manager.

Setting up a venv is the *expected* approach to such situations, and
creating one doesn't cause any problems. You end up with a pip in the
activated venv that's going to install to a different path (the one in
the venv), and will not be marked as externally managed, as the package
manager has no control over that path.

That's the whole point.  What error are you getting?  The venv
module is
not the pip module so restrictions on the system pip have nothing to do
with it.

set up pyenv
activated a venv
trying to install python3.12 into it

1. download of python3.12 (blahblahblahetc).deb will not install
2. download of python3.12.tar.xz similarly will not install

(venv2) memyself@devuanbigbox:~$ pip install 
/home/memyself/Downloads/Python-3.12.4.tar.xz

Processing ./Downloads/Python-3.12.4.tar.xz
ERROR: file:///home/memyself/Downloads/Python-3.12.4.tar.xz does not 
appear to be a Python project: neither 'setup.py' nor 'pyproject.toml' 
found.


seems that I need a different version (installable as it were) of 
python3.12

or my approach is all wrong!



you can't install Python "into" a venv.

you use a version of Python as the base when *creating* a venv, the venv 
will use the same binary as the base python (symlinks if possible, as in 
the Linux case), but with different paths.


Since you've already got pyenv, use it to build the version you want to 
use - I think you said there wasn't a deb for 3.12 in your distro? 
That's something like


pyenv install 3.12.4

that will use the build recipe it has... and hopefully work.  Distro 
Pythons sometimes have some strange setups that are hard to reproduce. 
Pyenv knows how to build micropython, too, should it ever come to that.


If you indeed found a deb for the right Python, use apt to install it, 
and then use *that* Python to create your venv.


If you have the pyenv-virtualenv plugin, you can ask it to make the 
virtualenv for you, if pyenv built the Python





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


Re: Help needed - - running into issues with python and its tools

2024-08-05 Thread Bill Deegan via Python-list
Your approach is wrong.
You don't build python from source using pip.

You don't install new versions of python into a venv either.

Have you read the following?
https://docs.micropython.org/en/latest/esp8266/tutorial/intro.html

That seems to have instructions for what you want to do..

-Bill



On Mon, Aug 5, 2024 at 1:41 PM o1bigtenor via Python-list <
python-list@python.org> wrote:

> Matt - if you would rather that you were not included in the address list -
> -
> please advise.
>
> On Mon, Aug 5, 2024 at 8:51 AM Mats Wichmann  wrote:
>
> > On 8/5/24 06:48, o1bigtenor via Python-list wrote:
> > > On Sun, Aug 4, 2024 at 8:49 AM Mats Wichmann via Python-list <
> > > python-list@python.org> wrote:
> > >
> > >> On 8/3/24 20:03, o1bigtenor via Python-list wrote:
> > >>
> > >>> My question was, is and will be (and the doc absolutely doesn't cover
> > it)
> > >>> how do I install a different version in the venv so that python
> 3.11.x
> > on
> > >>> the
> > >>> system is not discombobulated by the python 3.12.x in the venv.
> > >>> That python 3.12 would let me run the tools needed.
> > >>> (Its the how to install the next version of python that I just
> haven't
> > >> been
> > >>> able to find information on - - - and I would be looking for
> > information
> > >>> on how to install on a *nix.)
> > >>
> > >> To get a different Python "in" the venv, you use the version you want
> in
> > >> the construction of the venv. For example:
> > >>
> > >>
> > >> $ python3.13 -m venv new_venv
> > >> $ new_venv/bin/python --version
> > >> Python 3.13.0b4
> > >> $ source new_venv/bin/activate
> > >>
> > >>
> > >   "https://peps.python.org/pep-0668/ PEP 668, which prevents pip from
> > > interacting with the OS installed python. This change has been done in
> > red
> > > hat and other distros too . . . "
> > >
> > > similarly your first command produces and error code for the same
> reason.
> > >
> > > Sorry - - - not my policy - - -
> >
> > What? Yes, the *system* pip should have some restrictions, if it's a
> > system mainly managed by a package manager.
> >
> > Setting up a venv is the *expected* approach to such situations, and
> > creating one doesn't cause any problems. You end up with a pip in the
> > activated venv that's going to install to a different path (the one in
> > the venv), and will not be marked as externally managed, as the package
> > manager has no control over that path.
> >
> > That's the whole point.  What error are you getting?  The venv module is
> > not the pip module so restrictions on the system pip have nothing to do
> > with it.
> >
> > set up pyenv
> activated a venv
> trying to install python3.12 into it
>
> 1. download of python3.12 (blahblahblahetc).deb will not install
> 2. download of python3.12.tar.xz similarly will not install
>
> (venv2) memyself@devuanbigbox:~$ pip install
> /home/memyself/Downloads/Python-3.12.4.tar.xz
> Processing ./Downloads/Python-3.12.4.tar.xz
> ERROR: file:///home/memyself/Downloads/Python-3.12.4.tar.xz does not appear
> to be a Python project: neither 'setup.py' nor 'pyproject.toml' found.
>
> seems that I need a different version (installable as it were) of
> python3.12
> or my approach is all wrong!
>
> Please advise
>
> TIA
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help needed - - running into issues with python and its tools

2024-08-05 Thread o1bigtenor via Python-list
Matt - if you would rather that you were not included in the address list -
-
please advise.

On Mon, Aug 5, 2024 at 8:51 AM Mats Wichmann  wrote:

> On 8/5/24 06:48, o1bigtenor via Python-list wrote:
> > On Sun, Aug 4, 2024 at 8:49 AM Mats Wichmann via Python-list <
> > python-list@python.org> wrote:
> >
> >> On 8/3/24 20:03, o1bigtenor via Python-list wrote:
> >>
> >>> My question was, is and will be (and the doc absolutely doesn't cover
> it)
> >>> how do I install a different version in the venv so that python 3.11.x
> on
> >>> the
> >>> system is not discombobulated by the python 3.12.x in the venv.
> >>> That python 3.12 would let me run the tools needed.
> >>> (Its the how to install the next version of python that I just haven't
> >> been
> >>> able to find information on - - - and I would be looking for
> information
> >>> on how to install on a *nix.)
> >>
> >> To get a different Python "in" the venv, you use the version you want in
> >> the construction of the venv. For example:
> >>
> >>
> >> $ python3.13 -m venv new_venv
> >> $ new_venv/bin/python --version
> >> Python 3.13.0b4
> >> $ source new_venv/bin/activate
> >>
> >>
> >   "https://peps.python.org/pep-0668/ PEP 668, which prevents pip from
> > interacting with the OS installed python. This change has been done in
> red
> > hat and other distros too . . . "
> >
> > similarly your first command produces and error code for the same reason.
> >
> > Sorry - - - not my policy - - -
>
> What? Yes, the *system* pip should have some restrictions, if it's a
> system mainly managed by a package manager.
>
> Setting up a venv is the *expected* approach to such situations, and
> creating one doesn't cause any problems. You end up with a pip in the
> activated venv that's going to install to a different path (the one in
> the venv), and will not be marked as externally managed, as the package
> manager has no control over that path.
>
> That's the whole point.  What error are you getting?  The venv module is
> not the pip module so restrictions on the system pip have nothing to do
> with it.
>
> set up pyenv
activated a venv
trying to install python3.12 into it

1. download of python3.12 (blahblahblahetc).deb will not install
2. download of python3.12.tar.xz similarly will not install

(venv2) memyself@devuanbigbox:~$ pip install
/home/memyself/Downloads/Python-3.12.4.tar.xz
Processing ./Downloads/Python-3.12.4.tar.xz
ERROR: file:///home/memyself/Downloads/Python-3.12.4.tar.xz does not appear
to be a Python project: neither 'setup.py' nor 'pyproject.toml' found.

seems that I need a different version (installable as it were) of
python3.12
or my approach is all wrong!

Please advise

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


Re: Help needed - - running into issues with python and its tools

2024-08-05 Thread Mats Wichmann via Python-list

On 8/5/24 06:48, o1bigtenor via Python-list wrote:

On Sun, Aug 4, 2024 at 8:49 AM Mats Wichmann via Python-list <
python-list@python.org> wrote:


On 8/3/24 20:03, o1bigtenor via Python-list wrote:


My question was, is and will be (and the doc absolutely doesn't cover it)
how do I install a different version in the venv so that python 3.11.x on
the
system is not discombobulated by the python 3.12.x in the venv.
That python 3.12 would let me run the tools needed.
(Its the how to install the next version of python that I just haven't

been

able to find information on - - - and I would be looking for information
on how to install on a *nix.)


To get a different Python "in" the venv, you use the version you want in
the construction of the venv. For example:


$ python3.13 -m venv new_venv
$ new_venv/bin/python --version
Python 3.13.0b4
$ source new_venv/bin/activate



  "https://peps.python.org/pep-0668/ PEP 668, which prevents pip from
interacting with the OS installed python. This change has been done in red
hat and other distros too . . . "

similarly your first command produces and error code for the same reason.

Sorry - - - not my policy - - -


What? Yes, the *system* pip should have some restrictions, if it's a 
system mainly managed by a package manager.


Setting up a venv is the *expected* approach to such situations, and 
creating one doesn't cause any problems. You end up with a pip in the 
activated venv that's going to install to a different path (the one in 
the venv), and will not be marked as externally managed, as the package 
manager has no control over that path.


That's the whole point.  What error are you getting?  The venv module is 
not the pip module so restrictions on the system pip have nothing to do 
with it.




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


Re: Help needed - - running into issues with python and its tools

2024-08-05 Thread o1bigtenor via Python-list
On Sun, Aug 4, 2024 at 8:49 AM Mats Wichmann via Python-list <
python-list@python.org> wrote:

> On 8/3/24 20:03, o1bigtenor via Python-list wrote:
>
> > My question was, is and will be (and the doc absolutely doesn't cover it)
> > how do I install a different version in the venv so that python 3.11.x on
> > the
> > system is not discombobulated by the python 3.12.x in the venv.
> > That python 3.12 would let me run the tools needed.
> > (Its the how to install the next version of python that I just haven't
> been
> > able to find information on - - - and I would be looking for information
> > on how to install on a *nix.)
>
> To get a different Python "in" the venv, you use the version you want in
> the construction of the venv. For example:
>
>
> $ python3.13 -m venv new_venv
> $ new_venv/bin/python --version
> Python 3.13.0b4
> $ source new_venv/bin/activate
>
>
 "https://peps.python.org/pep-0668/ PEP 668, which prevents pip from
interacting with the OS installed python. This change has been done in red
hat and other distros too . . . "

similarly your first command produces and error code for the same reason.

Sorry - - - not my policy - - -

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


Re: Help needed - - running into issues with python and its tools

2024-08-05 Thread o1bigtenor via Python-list
On Sun, Aug 4, 2024 at 4:24 AM Peter J. Holzer via Python-list <
python-list@python.org> wrote:

> On 2024-08-03 15:17:11 -0500, o1bigtenor via Python-list wrote:
> > One of the tools I need to be able to use is esptools - -  well in the
> > devuan world you need to run that on either Devaun 3 or 5 - - - its just
> > not available on devuan 4.
>
> Couldn't you just upgrade to Devuan 5, then?
>

I like uptime and not measured in hours either so I'm presently not running
Devuan 5
or testing - - - although I used to. Just found that I didn't need the most
recent versions
of most of the tools I was using so find the stability (except for the
bloody browsers)
in stable version is to be appreciated.

>
>
> > Tried installing all the tools I need using downloads and .deb installs
> but
> > then I need to have python3.12 and that's also not part of Devuan4.
>
> It seems weird that something would work with the (presumably) older
> version of Python in Devuan 3 and the (presumably) newer version of
> Python in Devuan 5, but not with the version in Devuan 4.
>

Well - - - pstool was available in a version that worked in Devuan 3,
psytool is available in a version that works in Devuan 4 - - - beyond my
pay
grade as to why there isn't a version available for Devuan 4.

>
>
> > Not versed enough to set up a good venv (if that's possible) so that I
> > could work in that specific venv and have my cake (and get to eat it too
> > (grin!).
>
> You need to install Python first to create a venv. AFAIK there is no way
> to set up a venv first and then install Python into it.
>
> Does Devuan have a testing or unstable suite? You might be able to
> install a newer Python version from that. If not your best bet is to
> install Python from source.
>
>
First question answered earlier.
If I installed python 3.12 from source I would create a hung system for
myself.
(Been there and done that - - - got the T-shirt and it still stinks!)

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


Re: Help needed - - running into issues with python and its tools

2024-08-04 Thread Mats Wichmann via Python-list

On 8/3/24 20:03, o1bigtenor via Python-list wrote:


My question was, is and will be (and the doc absolutely doesn't cover it)
how do I install a different version in the venv so that python 3.11.x on
the
system is not discombobulated by the python 3.12.x in the venv.
That python 3.12 would let me run the tools needed.
(Its the how to install the next version of python that I just haven't been
able to find information on - - - and I would be looking for information
on how to install on a *nix.)


To get a different Python "in" the venv, you use the version you want in 
the construction of the venv. For example:



$ python3.13 -m venv new_venv
$ new_venv/bin/python --version
Python 3.13.0b4
$ source new_venv/bin/activate
...




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


Re: Help needed - - running into issues with python and its tools

2024-08-04 Thread Peter J. Holzer via Python-list
On 2024-08-03 15:17:11 -0500, o1bigtenor via Python-list wrote:
> One of the tools I need to be able to use is esptools - -  well in the
> devuan world you need to run that on either Devaun 3 or 5 - - - its just
> not available on devuan 4.

Couldn't you just upgrade to Devuan 5, then?


> Tried installing all the tools I need using downloads and .deb installs but
> then I need to have python3.12 and that's also not part of Devuan4.

It seems weird that something would work with the (presumably) older
version of Python in Devuan 3 and the (presumably) newer version of
Python in Devuan 5, but not with the version in Devuan 4.


> Not versed enough to set up a good venv (if that's possible) so that I
> could work in that specific venv and have my cake (and get to eat it too
> (grin!).

You need to install Python first to create a venv. AFAIK there is no way
to set up a venv first and then install Python into it.

Does Devuan have a testing or unstable suite? You might be able to
install a newer Python version from that. If not your best bet is to
install Python from source.

hp


-- 
   _  | Peter J. Holzer| Story must make more sense than reality.
|_|_) ||
| |   | h...@hjp.at |-- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |   challenge!"


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


Re: Help needed - - running into issues with python and its tools

2024-08-03 Thread o1bigtenor via Python-list
On Sat, Aug 3, 2024 at 7:11 PM dn via Python-list 
wrote:

> On 4/08/24 09:34, o1bigtenor via Python-list wrote:
> > On Sat, Aug 3, 2024 at 4:06 PM dn via Python-list <
> python-list@python.org>
> > wrote:
> >
> >> On 4/08/24 08:17, o1bigtenor via Python-list wrote:
> >>> Greetings
> >>>
> >>> Looking at ESP8266 and wanting to program it using micropython (really
> >>> don't want to have to learn C++ (not enough hours in the day as it
> >> is!!)).
> >>>
> >>> One of the tools I need to be able to use is esptools - -  well in the
> >>> devuan world you need to run that on either Devaun 3 or 5 - - - its
> just
> >>> not available on devuan 4.
> >>>
> >>> Tried installing all the tools I need using downloads and .deb installs
> >> but
> >>> then I need to have python3.12 and that's also not part of Devuan4.
> >>>
> >>> Not versed enough to set up a good venv (if that's possible) so that I
> >>> could work in that specific venv and have my cake (and get to eat it
> too
> >>> (grin!).
> >>>
> >>> Suggestions - - - ideas - - - please?
> >>
> >> Sorry if this offends, but this is a list of short-cuts and reasons why
> >> they don't work (immediately).
> >>
> >>
> >> Have just come from a discussion about 'how to start a project'. Amongst
> >> the questions to ask are: "what resources do we have (or can add) to
> >> achieve?".
> >>
> >
> > Fair question details interleaved - - -
> >
> >>
> >> In this case, if Python-skill is a "personnel-resource" (and C++ a
> >> "constraint"), will question the ESP over Raspberry Pi (say)?
> >>
> >
> > Well - - - RPi world technical specs is usable from -20 to 60 C (iirc on
> > the top number)
> > and for my project I absolutely need to have usability to at least -40 -
> -
> > could possibly do a bit less but -35 C is a hard requirement so the RPi
> > and Pico (which I would like to use) is out but ESP8266 runs in that -40
> to
> > 65 C
> > range.
>
> Interesting, but creates a mis-match of tools - battles for you to fight...
>

Not really - - - it takes a computer with psytool and about 5 or 6 other
python3.12
programs to load the microcontroller.
It is in writing the program for the microcontroller that micropython is
used not at
all in the loading.

>
>
> >> Why talking of Python 3.12 when the solution involves MicroPython?
> >>
> >
> > Because one uses psytool on one computer to transfer a program to the
> > MicroPython system.  In fact there are a set of tools that need
> Python3.12
> > to be able to do this and therefore the question.
> >
> >>
> >>
> >> Perhaps need to take a step back and look at 'options' - relate needs to
> >> resources, and evaluate the impact of each decision on later ones - as
> >> well as against your personal skills (modify objectives to limits, or
> >> accept that some learning/training will be necessary as pre-requisite to
> >> (being able to) attack the project).
> >>
> >> I have been investigating using a venv but am not finding clear
> directions
> > so
> > that I could set up Python3.12 inside (along with the other needed
> tools).
> > The
> > more I'm looking the less useful most of the information I'm finding is
> > becoming.
> > Therefore I thought I would go to the python gurus for information - - -
> > which I
> > have.
> >
> > So please - - - how do I set up a venv so that I can install and run
> python
> > 3.12
> > (and other needed programs related to 3.12) inside?
>
> If you mean venv itself, which "directions" have you reviewed?
> This one (https://python.land/virtual-environments/virtualenv) seems
> very straight-forward and shows "What's inside a venv?" to include
> python.exe. Given that venv is more-or-less the official/traditional
> solution, what are you doing differently - perhaps the question is
> lacking detail.
>
> Interesting - - - that's the doc I have been reading.

My question was, is and will be (and the doc absolutely doesn't cover it)
how do I install a different version in the venv so that python 3.11.x on
the
system is not discombobulated by the python 3.12.x in the venv.
That python 3.12 would let me run the tools needed.
(Its the how to install the next version of python that I just haven't been
able to find information on - - - and I would be looking for information
on how to install on a *nix.)


> Personally, I'm using Poetry (https://python-poetry.org) which seemed
> just as easy to pick-up; plus pyenv to maintain multiple versions of
> Python on one machine.
>
>
Will give python-poetry a look.

Have been looking at pyenv but that seems to be a whole rat's nest of other
stuff to install and its using a bunch of different tools to get there - -
- is it
necessary - - - yes or no (in the running of multiple python versions on
the
same machine).

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


Re: Help needed - - running into issues with python and its tools

2024-08-03 Thread o1bigtenor via Python-list
On Sat, Aug 3, 2024 at 6:20 PM Cameron Simpson via Python-list <
python-list@python.org> wrote:

> On 03Aug2024 16:34, o1bigtenor  wrote:
> >So please - - - how do I set up a venv so that I can install and run
> >python
> >3.12
> >(and other needed programs related to 3.12) inside?
>
> Maybe this github comment will help with this:
>
> https://github.com/orgs/micropython/discussions/10255#discussioncomment-671
>

Not really.

A computer that has psytool + about 5 or 6 other python 3.12 tools is
needed to load
the microcontroller so I don't see how having venv in the microcontroller
would help the
loading of software onto the microcontroller.

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


Re: Help needed - - running into issues with python and its tools

2024-08-03 Thread dn via Python-list

On 4/08/24 09:34, o1bigtenor via Python-list wrote:

On Sat, Aug 3, 2024 at 4:06 PM dn via Python-list 
wrote:


On 4/08/24 08:17, o1bigtenor via Python-list wrote:

Greetings

Looking at ESP8266 and wanting to program it using micropython (really
don't want to have to learn C++ (not enough hours in the day as it

is!!)).


One of the tools I need to be able to use is esptools - -  well in the
devuan world you need to run that on either Devaun 3 or 5 - - - its just
not available on devuan 4.

Tried installing all the tools I need using downloads and .deb installs

but

then I need to have python3.12 and that's also not part of Devuan4.

Not versed enough to set up a good venv (if that's possible) so that I
could work in that specific venv and have my cake (and get to eat it too
(grin!).

Suggestions - - - ideas - - - please?


Sorry if this offends, but this is a list of short-cuts and reasons why
they don't work (immediately).


Have just come from a discussion about 'how to start a project'. Amongst
the questions to ask are: "what resources do we have (or can add) to
achieve?".



Fair question details interleaved - - -



In this case, if Python-skill is a "personnel-resource" (and C++ a
"constraint"), will question the ESP over Raspberry Pi (say)?



Well - - - RPi world technical specs is usable from -20 to 60 C (iirc on
the top number)
and for my project I absolutely need to have usability to at least -40 - -
could possibly do a bit less but -35 C is a hard requirement so the RPi
and Pico (which I would like to use) is out but ESP8266 runs in that -40 to
65 C
range.


Interesting, but creates a mis-match of tools - battles for you to fight...



Why talking of Python 3.12 when the solution involves MicroPython?



Because one uses psytool on one computer to transfer a program to the
MicroPython system.  In fact there are a set of tools that need Python3.12
to be able to do this and therefore the question.




Perhaps need to take a step back and look at 'options' - relate needs to
resources, and evaluate the impact of each decision on later ones - as
well as against your personal skills (modify objectives to limits, or
accept that some learning/training will be necessary as pre-requisite to
(being able to) attack the project).

I have been investigating using a venv but am not finding clear directions

so
that I could set up Python3.12 inside (along with the other needed tools).
The
more I'm looking the less useful most of the information I'm finding is
becoming.
Therefore I thought I would go to the python gurus for information - - -
which I
have.

So please - - - how do I set up a venv so that I can install and run python
3.12
(and other needed programs related to 3.12) inside?


If you mean venv itself, which "directions" have you reviewed?
This one (https://python.land/virtual-environments/virtualenv) seems 
very straight-forward and shows "What's inside a venv?" to include 
python.exe. Given that venv is more-or-less the official/traditional 
solution, what are you doing differently - perhaps the question is 
lacking detail.

(see also @Cameron's take)

Personally, I'm using Poetry (https://python-poetry.org) which seemed 
just as easy to pick-up; plus pyenv to maintain multiple versions of 
Python on one machine.


--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list


Re: Help needed - - running into issues with python and its tools

2024-08-03 Thread Cameron Simpson via Python-list

On 03Aug2024 16:34, o1bigtenor  wrote:
So please - - - how do I set up a venv so that I can install and run 
python

3.12
(and other needed programs related to 3.12) inside?


Maybe this github comment will help with this:
https://github.com/orgs/micropython/discussions/10255#discussioncomment-671
--
https://mail.python.org/mailman/listinfo/python-list


Re: Help needed - - running into issues with python and its tools

2024-08-03 Thread o1bigtenor via Python-list
On Sat, Aug 3, 2024 at 4:06 PM dn via Python-list 
wrote:

> On 4/08/24 08:17, o1bigtenor via Python-list wrote:
> > Greetings
> >
> > Looking at ESP8266 and wanting to program it using micropython (really
> > don't want to have to learn C++ (not enough hours in the day as it
> is!!)).
> >
> > One of the tools I need to be able to use is esptools - -  well in the
> > devuan world you need to run that on either Devaun 3 or 5 - - - its just
> > not available on devuan 4.
> >
> > Tried installing all the tools I need using downloads and .deb installs
> but
> > then I need to have python3.12 and that's also not part of Devuan4.
> >
> > Not versed enough to set up a good venv (if that's possible) so that I
> > could work in that specific venv and have my cake (and get to eat it too
> > (grin!).
> >
> > Suggestions - - - ideas - - - please?
>
> Sorry if this offends, but this is a list of short-cuts and reasons why
> they don't work (immediately).
>
>
> Have just come from a discussion about 'how to start a project'. Amongst
> the questions to ask are: "what resources do we have (or can add) to
> achieve?".
>

Fair question details interleaved - - -

>
> In this case, if Python-skill is a "personnel-resource" (and C++ a
> "constraint"), will question the ESP over Raspberry Pi (say)?
>

Well - - - RPi world technical specs is usable from -20 to 60 C (iirc on
the top number)
and for my project I absolutely need to have usability to at least -40 - -
could possibly do a bit less but -35 C is a hard requirement so the RPi
and Pico (which I would like to use) is out but ESP8266 runs in that -40 to
65 C
range.

>
> Why talking of Python 3.12 when the solution involves MicroPython?
>

Because one uses psytool on one computer to transfer a program to the
MicroPython system.  In fact there are a set of tools that need Python3.12
to be able to do this and therefore the question.

>
>
> Perhaps need to take a step back and look at 'options' - relate needs to
> resources, and evaluate the impact of each decision on later ones - as
> well as against your personal skills (modify objectives to limits, or
> accept that some learning/training will be necessary as pre-requisite to
> (being able to) attack the project).
>
> I have been investigating using a venv but am not finding clear directions
so
that I could set up Python3.12 inside (along with the other needed tools).
The
more I'm looking the less useful most of the information I'm finding is
becoming.
Therefore I thought I would go to the python gurus for information - - -
which I
have.

So please - - - how do I set up a venv so that I can install and run python
3.12
(and other needed programs related to 3.12) inside?

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


Re: Help needed - - running into issues with python and its tools

2024-08-03 Thread dn via Python-list

On 4/08/24 08:17, o1bigtenor via Python-list wrote:

Greetings

Looking at ESP8266 and wanting to program it using micropython (really
don't want to have to learn C++ (not enough hours in the day as it is!!)).

One of the tools I need to be able to use is esptools - -  well in the
devuan world you need to run that on either Devaun 3 or 5 - - - its just
not available on devuan 4.

Tried installing all the tools I need using downloads and .deb installs but
then I need to have python3.12 and that's also not part of Devuan4.

Not versed enough to set up a good venv (if that's possible) so that I
could work in that specific venv and have my cake (and get to eat it too
(grin!).

Suggestions - - - ideas - - - please?


Sorry if this offends, but this is a list of short-cuts and reasons why 
they don't work (immediately).



Have just come from a discussion about 'how to start a project'. Amongst 
the questions to ask are: "what resources do we have (or can add) to 
achieve?".


In this case, if Python-skill is a "personnel-resource" (and C++ a 
"constraint"), will question the ESP over Raspberry Pi (say)?


Why talking of Python 3.12 when the solution involves MicroPython?


Perhaps need to take a step back and look at 'options' - relate needs to 
resources, and evaluate the impact of each decision on later ones - as 
well as against your personal skills (modify objectives to limits, or 
accept that some learning/training will be necessary as pre-requisite to 
(being able to) attack the project).


--
Regards =dn

--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list


Help needed - - running into issues with python and its tools

2024-08-03 Thread o1bigtenor via Python-list
Greetings

Looking at ESP8266 and wanting to program it using micropython (really
don't want to have to learn C++ (not enough hours in the day as it is!!)).

One of the tools I need to be able to use is esptools - -  well in the
devuan world you need to run that on either Devaun 3 or 5 - - - its just
not available on devuan 4.

Tried installing all the tools I need using downloads and .deb installs but
then I need to have python3.12 and that's also not part of Devuan4.

Not versed enough to set up a good venv (if that's possible) so that I
could work in that specific venv and have my cake (and get to eat it too
(grin!).

Suggestions - - - ideas - - - please?

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


[RELEASE] Python 3.13.0 release candidate 1 released

2024-08-01 Thread Thomas Wouters via Python-list
Python 3.13 *release candidate 1* is now available.

https://www.python.org/downloads/release/python-3130rc1/

<https://discuss.python.org/t/python-3-13-0-release-candidate-1-released/59703#p-181511-this-is-the-first-release-candidate-of-python-3130-1>This
is the first release candidate of Python 3.13.0

This release, *3.13.0rc1*, is the penultimate release preview. Entering the
release candidate phase, only reviewed code changes which are clear bug
fixes are allowed between this release candidate and the final release. The
second candidate (and the last planned release preview) is scheduled for
Tuesday, 2024-09-03, while the official release of 3.13.0 is scheduled for
Tuesday, 2024-10-01.

There will be *no ABI changes* from this point forward in the 3.13 series,
and the goal is that there will be as few code changes as possible.
<https://discuss.python.org/t/python-3-13-0-release-candidate-1-released/59703#p-181511-call-to-action-2>Call
to action

We strongly encourage maintainers of third-party Python projects to prepare
their projects for 3.13 compatibilities during this phase, and where
necessary publish Python 3.13 wheels on PyPI to be ready for the final
release of 3.13.0. Any binary wheels built against Python 3.13.0rc1 *will
work* with future versions of Python 3.13. As always, report any issues to the
Python bug tracker <https://github.com/python/cpython/issues>.

Please keep in mind that this is a preview release and while it’s as close
to the final release as we can get it, its use is *not* recommended for
production environments.
<https://discuss.python.org/t/python-3-13-0-release-candidate-1-released/59703#p-181511-core-developers-time-to-work-on-documentation-now-3>Core
developers: time to work on documentation now

   - Are all your changes properly documented?
   - Are they mentioned in What’s New
   <https://docs.python.org/3.13/whatsnew/3.13.html>?
   - Did you notice other changes you know of to have insufficient
   documentation?

<https://discuss.python.org/t/python-3-13-0-release-candidate-1-released/59703#p-181511-major-new-features-of-the-313-series-compared-to-312-4>Major
new features of the 3.13 series, compared to 3.12

Some of the new major new features and changes in Python 3.13 are:
<https://discuss.python.org/t/python-3-13-0-release-candidate-1-released/59703#p-181511-new-features-5>New
features

   - A new and improved interactive interpreter
   
<https://docs.python.org/3.13/whatsnew/3.13.html#a-better-interactive-interpreter>,
   based on PyPy <https://pypy.org>’s, featuring multi-line editing and
   color support, as well as colorized exception tracebacks
   <https://docs.python.org/3.13/whatsnew/3.13.html#improved-error-messages>
   .
   - An *experimental* free-threaded build mode
   <https://docs.python.org/3.13/whatsnew/3.13.html#free-threaded-cpython>,
   which disables the Global Interpreter Lock, allowing threads to run more
   concurrently. The build mode is available as an experimental feature in the
   Windows and macOS installers as well.
   - A preliminary, *experimental* JIT
   <https://docs.python.org/3.13/whatsnew/3.13.html#experimental-jit-compiler>,
   providing the ground work for significant performance improvements.
   - The locals() builtin function (and its C equivalent) now has well-defined
   semantics when mutating the returned mapping
   
<https://docs.python.org/3.13/whatsnew/3.13.html#defined-mutation-semantics-for-locals>,
   which allows debuggers to operate more consistently.
   - The (cyclic) garbage collector is now incremental
   
<https://docs.python.org/3.13/whatsnew/3.13.html#incremental-garbage-collection>,
   which should mean shorter pauses for collection in programs with a lot of
   objects.
   - A modified version of mimalloc <https://github.com/microsoft/mimalloc>
   is now included, optional but enabled by default if supported by the
   platform, and required for the free-threaded build mode.
   - Docstrings now have their leading indentation stripped
   <https://docs.python.org/3.13/whatsnew/3.13.html#other-language-changes>,
   reducing memory use and the size of .pyc files. (Most tools handling
   docstrings already strip leading indentation.)
   - The dbm module <https://docs.python.org/3.13/library/dbm.html> has a
   new dbm.sqlite3 backend
   <https://docs.python.org/3.13/whatsnew/3.13.html#dbm> that is used by
   default when creating new files.
   - The minimum supported macOS version was changed from 10.9 to *10.13
   (High Sierra)*. Older macOS versions will not be supported going forward.
   - WASI is now a Tier 2 supported platform
   <https://peps.python.org/pep-0011/#tier-2>. Emscripten is no longer
an officially
   supported platform
   <https://peps.python.org/pep-0011/#no-longer-supported-platforms> (but
   Pyodide <https://pyodide.org> continues to support Emscripten).

[RELEASE] Python 3.13.0 beta 4 released.

2024-07-18 Thread Thomas Wouters via Python-list
Python 3.13.0b4, the final beta of Python 3.13, is now available:

https://www.python.org/downloads/release/python-3130b4/

*This is a beta preview of Python 3.13*

Python 3.13 is still in development. This release, 3.13.0b4, is the *final*
beta release preview of 3.13.

Beta release previews are intended to give the wider community the
opportunity to test new features and bug fixes and to prepare their
projects to support the new feature release.

We *strongly encourage* maintainers of third-party Python projects to *test
with 3.13* during the beta phase and report issues found to the Python bug
tracker <https://github.com/python/cpython/issues> as soon as possible.
While the release is planned to be feature complete entering the beta
phase, it is possible that features may be modified or, in rare cases,
deleted up until the start of the release candidate phase (Tuesday
2024-07-30). Our goal is to have *no ABI changes* after this final beta
release, and as few code changes as possible after 3.13.0rc1, the first
release candidate. To achieve that, it will be *extremely important* to get
as much exposure for 3.13 as possible during the beta phase.

Please keep in mind that this is a preview release and its use is *not*
recommended for production environments.
<https://discuss.python.org/t/python-3-13-0b4-now-available/58565#major-new-features-of-the-313-series-compared-to-312-1>Major
new features of the 3.13 series, compared to 3.12

Some of the new major new features and changes in Python 3.13 are:
<https://discuss.python.org/t/python-3-13-0b4-now-available/58565#new-features-2>New
features

   - A new and improved interactive interpreter
   
<https://docs.python.org/3.13/whatsnew/3.13.html#a-better-interactive-interpreter>,
   based on PyPy <https://pypy.org>’s, featuring multi-line editing and
   color support, as well as colorized exception tracebacks
   <https://docs.python.org/3.13/whatsnew/3.13.html#improved-error-messages>
   .
   - An *experimental* free-threaded build mode
   <https://docs.python.org/3.13/whatsnew/3.13.html#free-threaded-cpython>,
   which disables the Global Interpreter Lock, allowing threads to run more
   concurrently. The build mode is available as an experimental feature in the
   Windows and macOS installers as well.
   - A preliminary, *experimental* JIT
   <https://docs.python.org/3.13/whatsnew/3.13.html#experimental-jit-compiler>,
   providing the ground work for significant performance improvements.
   - The locals() builtin function (and its C equivalent) now has well-defined
   semantics when mutating the returned mapping
   
<https://docs.python.org/3.13/whatsnew/3.13.html#defined-mutation-semantics-for-locals>,
   which allows debuggers to operate more consistently.
   - The (cyclic) garbage collector is now incremental
   
<https://docs.python.org/3.13/whatsnew/3.13.html#incremental-garbage-collection>,
   which should mean shorter pauses for collection in programs with a lot of
   objects.
   - A modified version of mimalloc <https://github.com/microsoft/mimalloc>
   is now included, optional but enabled by default if supported by the
   platform, and required for the free-threaded build mode.
   - Docstrings now have their leading indentation stripped
   <https://docs.python.org/3.13/whatsnew/3.13.html#other-language-changes>,
   reducing memory use and the size of .pyc files. (Most tools handling
   docstrings already strip leading indentation.)
   - The dbm module <https://docs.python.org/3.13/library/dbm.html> has a
   new dbm.sqlite3 backend
   <https://docs.python.org/3.13/whatsnew/3.13.html#dbm> that is used by
   default when creating new files.
   - The minimum supported macOS version was changed from 10.9 to *10.13
   (High Sierra)*. Older macOS versions will not be supported going forward.
   - WASI is now a Tier 2 supported platform
   <https://peps.python.org/pep-0011/#tier-2>. Emscripten is no longer
an officially
   supported platform
   <https://peps.python.org/pep-0011/#no-longer-supported-platforms> (but
   Pyodide <https://pyodide.org> continues to support Emscripten).

<https://discuss.python.org/t/python-3-13-0b4-now-available/58565#typing-3>
Typing

   - Support for type defaults in type parameters
   <https://peps.python.org/pep-0696/>.
   - A new type narrowing annotation <https://peps.python.org/pep-0742/>,
   typing.TypeIs.
   - A new annotation for read-only items in TypeDicts
   <https://peps.python.org/pep-0705/>.
   - A new annotation for marking deprecations in the type system
   <https://peps.python.org/pep-0702>.

<https://discuss.python.org/t/python-3-13-0b4-now-available/58565#removals-and-new-deprecations-4>Removals
and new deprecations

   - PEP 594 (Removing dead batteries from the standard library)
   <https://peps.python.org/pep-0594/> scheduled removals of many
   deprecated modul

Re: Password Hash Validation (Posting On Python-List Prohibited)

2024-07-12 Thread Lawrence D'Oliveiro via Python-list
On Fri, 21 Jun 2024 06:32:58 - (UTC), I wrote:

> On Fri, 21 Jun 2024 03:40:55 - (UTC), I wrote:
> 
>> I think I will create my own wrapper using ctypes.
> 
> Done <https://gitlab.com/ldo/nixcrypt>.

The repo now includes an example script that exercises the various 
functions of the module.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python repl vi mode line editing not working.

2024-07-11 Thread Tobiah via Python-list

I see the literal 'escape' character + 'k', when it should
let me edit previous commands.

I did have to compile my own python because I'm using 2.7 on
this machine.



I figured it out.  I needed to apt install libreadline-dev.
--
https://mail.python.org/mailman/listinfo/python-list


Re: python repl vi mode line editing not working.

2024-07-11 Thread Tobiah via Python-list

   For this to work, the Python implementation should use the same
   readline library as your shell, I guess.


It works in python3, so I guess my problem is that I'm
compiling python (I think kubuntu dropped python2), but
I don't see any relevant options  in the configure help.





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


python repl vi mode line editing not working.

2024-07-11 Thread Tobiah via Python-list

Kubuntu 24.04.


sinewave:toby ~(1)> cat .inputrc
set editing-mode vi
set keymap vi
sinewave:toby ~(1)> cat .editrc
bind -v
bind \\t rl_complete
sinewave:toby ~(1)> python
Python 2.7.18 (default, Jul  8 2024, 12:49:12)
[GCC 13.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
1  

1

2

2

^[k



I see the literal 'escape' character + 'k', when it should
let me edit previous commands.

I did have to compile my own python because I'm using 2.7 on
this machine.

Thanks for any help.


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


Re: python for irc client

2024-07-08 Thread orzodk via Python-list
Daniel via Python-list  writes:

> One thing missing is a good textmode irc client that will connect to
> quassel core.
>
> I've seen efforts to make a plugin for weechat but, to date, I don't see much
> progress on that end.
>
> In your wisdom, would python be a good environment to accomplish this? I'd
> likely use extended ascii and colors. The point would be to minimize the
> memory footprint of the application.

One feature of weechat you may be interested in is it's relay mode:

https://weechat.org/files/doc/weechat/stable/weechat_user.en.html#relay

If you flipped this architecture around you should be able to run
weechat as your bouncer then connect quassel or any other client to
weechat with it's IRC relay mode. Weechat also has a list of remote
interfaces that can use this

https://weechat.org/about/interfaces/

OTOH if you prefer the setup you've got I've had 0 issues with the
Python plugins I've written for weechat. A Quassel/weechat proxy plugin
should be pretty straight forward and if you prefer a standalone bridge,
as others have suggested Python is great for that too!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best (simplest) way to share data (Posting On Python-List Prohibited)

2024-07-08 Thread Chris Green via Python-list
Lawrence D'Oliveiro  wrote:
> On Sat, 6 Jul 2024 08:28:41 +0100, Chris Green wrote:
> 
> > One fairly obvious way is to have single process/script which reads the
> > A2D values continuously and writes them to a file.  All other scripts
> > then read from the file as needed, a simple file lock can then be used
> > to prevent simultaneous access (well, simultaneous access when the
> > writing process is writing).
> 
> The thing with a file is, it persists even when the collector process is 
> not running. Do you want data that persists when the collector process is 
> not running?
> 
> Is this a history of values, or just a snapshot of current values? A 
> history of values could be written to a database. Databases provide their 
> own transactions and interlocking to prevent readers from reading partial 
> updates.
> 
There's a separate (crontab driven) process that writes the history to
a sqlite3 database,


> If it’s a snapshot of current values, that does not persist when the 
> collector process is not running, then why not just keep the data in the 
> memory of the collector process, and have it concurrently listen on a 
> socket for connections from readers requesting a copy of the current data?

That's exactly the sort of solution I was wondering about.  Is there a
ready made module/library for handling this sort of thing?  Basically
it will just be a string of a few tens of characters that would be
kept up to date by one process and asked for by all the others.

-- 
Chris Green
·
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python for irc client

2024-07-04 Thread Daniel via Python-list
inhahe  writes:

> On Thu, Jul 4, 2024 at 5:14 AM Daniel via Python-list <
> python-list@python.org> wrote:
>
>> Hi guys -
>>
>> I have historical experience developing sofwtare for my own use. It has
>> been
>> quite a while since doing so and the advent of new languages has brought me
>> here. Python has built quite a reputation. It would be fun to pick up a
>> new language while I'm at it.
>>
>> I've been a consumer of IRC since the nineties and have been running an
>> instance of quassel core on an old laptop for the last decade. Over the
>> years, my use of xwindows has dramatically decreased and I spend 90% of my
>> computer time with multiple panes of tmux while I do my usual daily fun.
>> One
>> thing missing is a good textmode irc client that will connect to quassel
>> core.
>>
>> I've seen efforts to make a plugin for weechat but, to date, I don't see
>> much
>> progress on that end.
>>
>> In your wisdom, would python be a good environment to accomplish this? I'd
>> likely use extended ascii and colors. The point would be to minimize the
>> memory footprint of the application.
>>
>> I don't use standard desktop computers anymore - I'm writing this on my
>> beloved pi400 using emacs.
>>
>> Thanks
>>
>> Daniel
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>
>
> I think Python would be a great language to write an IRC client in, it's a
> rapid-development language, and also Python is particularly good for text
> manipulation and the IRC protocol is textual rather than binary. But, if
> your only purpose for using Python is to reduce the memory footprint, I'm
> not sure. I don't know specifically, but I'd guess Python has a higher
> memory footprint than, say, C, because it's a high-level language. For
> example, each variable has to be boxed, and also the interpreter has to be
> loaded..
>
> Regarding high ASCII, I don't know if that works in IRC, but either way,
> ASCII isn't really enough nowadays. You need to support Unicode;
> specifically, UTF-8.

Okay great. Since my original post, I settled on UTF8. I have to create
a list of requirements for v1.0 to limit scope creep and I can actually
get this done.

I may put it on github and solicit for assistance at some point.

Thanks for the response, both of them. I'll look at the other code and
see how I can fold it in. What I have to find out, still, is how the
core server manages the messages. I suspect the core does all the
sending and receiving and the client just sends the packets to core for
management. That's just a guess though.

I still have to review the liraries, this is a new idea hatched last
night so I have yet to investigate much.

My initial thought was C++ but this would be my first termianl-only
application in many years so I thought a different coding platform would
be effective.

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


Re: python for irc client

2024-07-04 Thread Left Right via Python-list
Hi.

Just FYI, I use Erc (in Emacs). I'm not a very advanced user, perhaps,
but I never felt like I miss anything. That's not to stop you from
making your own, but if you just need a decent text client for IRC,
then there's already at least one.

On Thu, Jul 4, 2024 at 11:30 AM inhahe via Python-list
 wrote:
>
> On Thu, Jul 4, 2024 at 5:22 AM inhahe  wrote:
>
> >
> >
> > On Thu, Jul 4, 2024 at 5:14 AM Daniel via Python-list <
> > python-list@python.org> wrote:
> >
> >>
> >> In your wisdom, would python be a good environment to accomplish this?
> >
> >
>
> > I think Python would be a great language to write an IRC client in, it's a
> > rapid-development language, and also Python is particularly good for text
> > manipulation and the IRC protocol is textual rather than binary.
> >
>
> Oh yeah, I forgot I was going to mention that Twisted has already done a
> lot of the dirty work for you if you make it in Python...they have twisted.
> words.protocols.irc, which implements the IRC protocol. (I don't know if
> it's up to date and supports ircv3, though.)
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python for irc client

2024-07-04 Thread inhahe via Python-list
On Thu, Jul 4, 2024 at 5:22 AM inhahe  wrote:

>
>
> On Thu, Jul 4, 2024 at 5:14 AM Daniel via Python-list <
> python-list@python.org> wrote:
>
>>
>> In your wisdom, would python be a good environment to accomplish this?
>
>

> I think Python would be a great language to write an IRC client in, it's a
> rapid-development language, and also Python is particularly good for text
> manipulation and the IRC protocol is textual rather than binary.
>

Oh yeah, I forgot I was going to mention that Twisted has already done a
lot of the dirty work for you if you make it in Python...they have twisted.
words.protocols.irc, which implements the IRC protocol. (I don't know if
it's up to date and supports ircv3, though.)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python for irc client

2024-07-04 Thread inhahe via Python-list
On Thu, Jul 4, 2024 at 5:14 AM Daniel via Python-list <
python-list@python.org> wrote:

> Hi guys -
>
> I have historical experience developing sofwtare for my own use. It has
> been
> quite a while since doing so and the advent of new languages has brought me
> here. Python has built quite a reputation. It would be fun to pick up a
> new language while I'm at it.
>
> I've been a consumer of IRC since the nineties and have been running an
> instance of quassel core on an old laptop for the last decade. Over the
> years, my use of xwindows has dramatically decreased and I spend 90% of my
> computer time with multiple panes of tmux while I do my usual daily fun.
> One
> thing missing is a good textmode irc client that will connect to quassel
> core.
>
> I've seen efforts to make a plugin for weechat but, to date, I don't see
> much
> progress on that end.
>
> In your wisdom, would python be a good environment to accomplish this? I'd
> likely use extended ascii and colors. The point would be to minimize the
> memory footprint of the application.
>
> I don't use standard desktop computers anymore - I'm writing this on my
> beloved pi400 using emacs.
>
> Thanks
>
> Daniel
> --
> https://mail.python.org/mailman/listinfo/python-list


I think Python would be a great language to write an IRC client in, it's a
rapid-development language, and also Python is particularly good for text
manipulation and the IRC protocol is textual rather than binary. But, if
your only purpose for using Python is to reduce the memory footprint, I'm
not sure. I don't know specifically, but I'd guess Python has a higher
memory footprint than, say, C, because it's a high-level language. For
example, each variable has to be boxed, and also the interpreter has to be
loaded..

Regarding high ASCII, I don't know if that works in IRC, but either way,
ASCII isn't really enough nowadays. You need to support Unicode;
specifically, UTF-8.
-- 
https://mail.python.org/mailman/listinfo/python-list


python for irc client

2024-07-04 Thread Daniel via Python-list
Hi guys -

I have historical experience developing sofwtare for my own use. It has been
quite a while since doing so and the advent of new languages has brought me
here. Python has built quite a reputation. It would be fun to pick up a
new language while I'm at it.

I've been a consumer of IRC since the nineties and have been running an
instance of quassel core on an old laptop for the last decade. Over the
years, my use of xwindows has dramatically decreased and I spend 90% of my
computer time with multiple panes of tmux while I do my usual daily fun. One
thing missing is a good textmode irc client that will connect to quassel
core.

I've seen efforts to make a plugin for weechat but, to date, I don't see much
progress on that end.

In your wisdom, would python be a good environment to accomplish this? I'd
likely use extended ascii and colors. The point would be to minimize the
memory footprint of the application.

I don't use standard desktop computers anymore - I'm writing this on my
beloved pi400 using emacs.

Thanks

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


ANN: eGenix PyRun - One file Python Runtime 2.5.0

2024-07-01 Thread eGenix Team via Python-list

*ANNOUNCING*


   eGenix PyRun - One file Python Runtime

Version 2.5.0

Python runtime taking up just 4-6MB on disk

This announcement is also available on our web-site for online reading:
https://www.egenix.com/company/news/eGenix-PyRun-2.5.0-GA.html


*INTRODUCTION*

*eGenix PyRun*™ <https://www.egenix.com/company/legal/trademarks.html> 
is our open source, one file, no installation version of Python, making 
the distribution of a Python interpreter to run Python based scripts and 
applications to Unix based systems simple and efficient.


eGenix PyRun's executable only needs 4-6MB on disk, but still supports 
most Python applications and scripts.


Compared to a regular Python installation of typically 100MB on disk, 
eGenix PyRun is ideal for applications and scripts that need to be 
distributed to containers, VMs, clusters, client installations, 
customers or end-users.


It makes "installing" Python on a Unix based system as simple as copying 
a single file.


eGenix has been using eGenix PyRun as run-time for the Linux version of 
mxODBC Connect Server 
<https://www.egenix.com/products/python/mxODBCConnect/> product since 
2008 with great success and decided to make it available as a 
stand-alone open-source product.


We provide the source archive to build your own *eGenix PyRun on Github* 
<https://github.com/eGenix/egenix-pyrun>, as well as a few binary 
distributions to get you started on Linux x86_64. In the future, we will 
set up automated builds for several other platforms.


Please see the product page for more details:

>>> eGenix PyRun - One file Python Runtime 
<https://www.egenix.com/products/python/PyRun/>




*NEWS*

This major release of eGenix PyRun 
<https://www.egenix.com/products/python/PyRun> comes with the following 
enhancements:


 * Added support for *Python 3.8 - 3.11*
 * Removed support for Python 3.5-3.7
 * Modernized the directory setup and build
 * Changed the license to the *Apache2 license*
 * Extracted the code from our internal mono-repo to put on Github
 * *Relaunched the project on Github*

For a complete list of changes, please see the *eGenix PyRun Changelog 
<https://www.egenix.com/products/python/PyRun/changelog.html>*.



Enjoy,

--
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Experts (#1, Jul 01 2024)

Python Projects, Coaching and Support ...https://www.egenix.com/
Python Product Development ...https://consulting.egenix.com/



::: We implement business ideas - efficiently in both time and costs :::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48

D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
   https://www.egenix.com/company/contact/
 https://www.malemburg.com/
--
https://mail.python.org/mailman/listinfo/python-list


[RELEASE] Python 3.13.0 beta 3 released.

2024-06-27 Thread Thomas Wouters via Python-list
The *next to last* Python 3.13 beta version, beta 3, is now released:
https://www.python.org/downloads/release/python-3130b3/

*This is a beta preview of Python 3.13*

Python 3.13 is still in development. This release, 3.13.0b3, is the third
of four beta release previews of 3.13.

Beta release previews are intended to give the wider community the
opportunity to test new features and bug fixes and to prepare their
projects to support the new feature release.

We *strongly encourage* maintainers of third-party Python projects to *test
with 3.13* during the beta phase and report issues found to the Python bug
tracker <https://github.com/python/cpython/issues> as soon as possible.
While the release is planned to be feature complete entering the beta
phase, it is possible that features may be modified or, in rare cases,
deleted up until the start of the release candidate phase (Tuesday
2024-07-30). Our goal is to have no ABI changes after beta 4 and as few
code changes as possible after 3.13.0rc1, the first release candidate. To
achieve that, it will be *extremely important* to get as much exposure for
3.13 as possible during the beta phase.

Please keep in mind that this is a preview release and its use is *not*
recommended for production environments.
<https://discuss.python.org/t/python-3-13-0-beta-3-now-available/56847#major-new-features-of-the-313-series-compared-to-312-1>Major
new features of the 3.13 series, compared to 3.12

Some of the new major new features and changes in Python 3.13 are:
<https://discuss.python.org/t/python-3-13-0-beta-3-now-available/56847#new-features-2>New
features

   - A new and improved interactive interpreter
   
<https://docs.python.org/3.13/whatsnew/3.13.html#a-better-interactive-interpreter>,
   based on PyPy <https://pypy.org>’s, featuring multi-line editing and
   color support, as well as colorized exception tracebacks
   <https://docs.python.org/3.13/whatsnew/3.13.html#improved-error-messages>
   .
   - An *experimental* free-threaded build mode
   <https://docs.python.org/3.13/whatsnew/3.13.html#free-threaded-cpython>,
   which disables the Global Interpreter Lock, allowing threads to run more
   concurrently. The build mode is available as an experimental feature in the
   Windows and macOS installers as well.
   - A preliminary, *experimental* JIT
   <https://docs.python.org/3.13/whatsnew/3.13.html#experimental-jit-compiler>,
   providing the ground work for significant performance improvements.
   - The (cyclic) garbage collector is now incremental
   
<https://docs.python.org/3.13/whatsnew/3.13.html#incremental-garbage-collection>,
   which should mean shorter pauses for collection in programs with a lot of
   objects.
   - A modified version of mimalloc <https://github.com/microsoft/mimalloc>
   is now included, optional but enabled by default if supported by the
   platform, and required for the free-threaded build mode.
   - Docstrings now have their leading indentation stripped
   <https://docs.python.org/3.13/whatsnew/3.13.html#other-language-changes>,
   reducing memory use and the size of .pyc files. (Most tools handling
   docstrings already strip leading indentation.)
   - The dbm module <https://docs.python.org/3.13/library/dbm.html> has a
   new dbm.sqlite3 backend
   <https://docs.python.org/3.13/whatsnew/3.13.html#dbm> that is used by
   default when creating new files.
   - The minimum supported macOS version was changed from 10.9 to *10.13
   (High Sierra)*. Older macOS versions will not be supported going forward.

<https://discuss.python.org/t/python-3-13-0-beta-3-now-available/56847#typing-3>
Typing

   - Support for type defaults in type parameters
   <https://peps.python.org/pep-0696/>.
   - A new type narrowing annotation <https://peps.python.org/pep-0742/>,
   typing.TypeIs.
   - A new annotation for read-only items in TypeDicts
   <https://peps.python.org/pep-0705/>.

<https://discuss.python.org/t/python-3-13-0-beta-3-now-available/56847#removals-and-new-deprecations-4>Removals
and new deprecations

   - PEP 594 (Removing dead batteries from the standard library)
   <https://peps.python.org/pep-0594/> scheduled removals of many
   deprecated modules: aifc, audioop, chunk, cgi, cgitb, crypt, imghdr,
   mailcap, msilib, nis, nntplib, ossaudiodev, pipes, sndhdr, spwd, sunau,
   telnetlib, uu, xdrlib, lib2to3.
   - Many other removals
   <https://docs.python.org/3.13/whatsnew/3.13.html#removed> of deprecated
   classes, functions and methods in various standard library modules.
   - C API removals <https://docs.python.org/3.13/whatsnew/3.13.html#id10>
   and deprecations <https://docs.python.org/3.13/whatsnew/3.13.html#id9>.
   (Some removals present in alpha 1 were reverted in alpha 2, as the removals
   were deemed too disruptive at this time.)
   - New deprecations
   <https://docs.python.org/3.13/whatsnew/3

Re: [Tutor] How to install tensorflow on Python 2.7 in Windows?

2024-06-26 Thread Mats Wichmann via Python-list

On 6/26/24 09:29, marc nicole wrote:

Browsing the available version of tensorflow for the dates before January
2021 (date when Python 2.7 stopped being supported) I can't find a
tensorflow version for Python 2.7 that works under Windows.

The reference site I use is https://pypi.org/project/tensorflow/

Anybody can point out a compatible .whl file with Python 2.7 and Windows?


The last version of tensorflow to support Python 2.7 was indeed 2.1, and 
I don't think there was *ever* an official Windows wheel for Python 2, 
but I'm not that expert to be completely sure. tensorflow support on 
Windows has never been good, and in a way they've given up, at least 
part of the fight: they no longer produce official releases for Windows 
with GPU support (although you may be able to get one from the vendor 
that produces the GPU hardware like Nvidia or Intel, or from a third 
party like Amazon Web Services). The official recommendation for WIndows 
used to be "build your own" (which nearly always failed), then for a few 
years they tried making Windows builds, now the new "best practice" 
recommendation is to install on WSL if you want to run on a Windows box 
(this *might* work for you, unless you're also on an ancient Windows 
that won't run WSL).  Or, try seeing if you can find a docker setup 
(which, again, will give you a Linux environment running tensorflow).


Note that like your other problem, getting numpy going, this is going to 
be an uphill battle trying to cobble things together to run on 2.7. 
This is really the problem when something like Python goes out of date / 
out of support: it's not that it magically stops working, it's that vast 
amounts of the ecosystem around it stop providing support for *their* 
bits on the old version, and the combinations become progressively 
harder to make work.



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


How to install tensorflow on Python 2.7 in Windows?

2024-06-26 Thread marc nicole via Python-list
Browsing the available version of tensorflow for the dates before January
2021 (date when Python 2.7 stopped being supported) I can't find a
tensorflow version for Python 2.7 that works under Windows.

The reference site I use is https://pypi.org/project/tensorflow/

Anybody can point out a compatible .whl file with Python 2.7 and Windows?
-- 
https://mail.python.org/mailman/listinfo/python-list


RE: [Tutor] How to go about a simple object grabbing in python (given coordinates of arms and objects)

2024-06-24 Thread AVI GROSS via Python-list
Marc,

Several people have supplied feedback on whether your request is a good fit for 
here. Ultimately it is up to the owner/moderator. In particular, your request 
to the Tutor List may not fit the purpose and be a bit complex  and to the main 
Python List also outside some common usage whether it is about a specific 
module or product you are using, or asking about algorithms in a very general 
way.

You question has evolved to being about algorithms, more than about Python as a 
basic language or even commonly used modules.

So, I suggest you simplify your model and then maybe bring it in-line with the 
module(s) you showed us you were using. Some of what you ask sounds like it 
would be extremely commonly done in things like robotics, or even just machines 
with moving parts.

Consider the somewhat related concept often seen of how you get from one place 
to another in parts of Manhattan where most of the streets run either in one 
direction or the orthogonal direction. How do you get from say East 14th Street 
at 1st Avenue to West 28th Street and 11th Avenue? This is a slight imitation 
of how to move a robotic arm that can mainly either go one way or another but 
not both at once. And, in the real world, parts of Manhattan are more complex 
with streets ending or renaming or running more diagonally or huge voids like 
Central Park.

The number of solutions is huge for walking, and smaller for driving as some 
streets are one way. But assuming you avoid wasteful paths (except when roads 
are closed for endless purposes) and you do not take a path through Brooklyn, 
Queens and The Bronx and back to Manhattan as in the NY Marathon that also 
touches another borough, the solutions mainly look like this:

Go as far horizontally as you need and then as far vertically.
Or, do vertical, then horizontal.
Or lots of combined versions such as climbing stairs by doing a block or three 
one way then some in the other and repeat.

The above is referred to as Manhattan Distance, as compared to other measures 
like Euclidean distance.

So back to your robot arm, you can see a set of simple solutions where you make 
a sort of triangle with the direct Euclidean arm being a hypoteneuse and the  X 
and Y movements are the other two sides. You can then break up your problem as 
heading one way and pausing and turning the other way and stopping just short 
of the object you want. If there are no obstacles, you can do that in either 
order. Or, you could alternate in smaller amounts and get to the same 
destination. 

Grabbing it would be something else I will not address except to say that 
depending on what is grabbing and how it is shaped, you may need to aim not for 
the object, but the appropriate distance and direction so that when you stop 
moving, the "grasper" can close on it, again, avoiding existing obstacles. And 
note, speed is a consideration as many things need to be approached slowly and 
gently.

Next, consider what it would mean if you could have a combined motion based on 
both operations allowed at the same time. Consider a robot that is on wheels 
that can move horizontally while also having a "lift" component that lifts the 
part with the graspers vertically. Both could be programmed to run in tandem at 
appropriate speeds so the graspers are traveling along the hypotenuse I mention 
and are going the shortest path. This might be faster and more economical in 
other ways but can be more complex. And, it may be the robot does not have 
power or computing ability to do both at the same time. Your design is beyond 
vague.

Both of the approaches above make a plan and carry it out. But in the real 
world, many algorithms must adjust and work somewhat probabilistically. One 
algorithm for say catching a moving object, especially one that can change 
speed and direction a bit, like a running dog or a kite flying in the wind, is 
to locate where the object seems to be now, perhaps just a direction and a 
guess at distance, and maybe with some observation make a guess at where it 
might be at some time in the future that is approximately when you might move 
the robot near there. Then, use a technique like above (or completely 
different) that perhaps aims to get you something like halfway there. Monitor 
along the way to update your position and the newest destination position (if 
it is moving) and re-evaluate and adjust for the next round and maybe evaluate 
again as you approach halfway or so, again. Eventually, if you are close, slow 
down and gradually try to come to a stop where you can grab. If the object 
reacts to your attempting to go after it, it can be complex. And, you may 
overshoot and sort of circle back.

Now, expand the problem more if needed. What does the robot look like. How many 
places can it bend? For example, can it have something like two or more elbows, 
perhaps one allowing twisting of up to 30 degrees and one moving forward and 
backward and another allow

Tkinter and astral characters (was: Decoding bytes to text strings in Python 2)

2024-06-24 Thread Peter J. Holzer via Python-list
On 2024-06-24 01:14:22 +0100, MRAB via Python-list wrote:
> Tkinter in recent versions of Python can handle astral characters, at least
> back to Python 3.8, the oldest I have on my Windows PC.

I just tried modifying
https://docs.python.org/3/library/tkinter.html#a-hello-world-program
to display "Hello World \N{ROCKET}" instead (Python 3.10.12 as included
with Ubuntu 22.04). I don't get a warning or error, but the emoji isn't
displayed either.

I suspect that the default font doesn't include emojis and Tk isn't
smart enough to fall back to a different font (unlike xfce4-terminal
which shows the emoji just fine).

hp

-- 
   _  | Peter J. Holzer| Story must make more sense than reality.
|_|_) ||
| |   | h...@hjp.at |-- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |   challenge!"


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


Re: [Tutor] How to go about a simple object grabbing in python (given coordinates of arms and objects)

2024-06-24 Thread marc nicole via Python-list
What are the parameters to account for in this type of algorithm? are there
some checks to perform the arm moves ? for example angle moves or cartesian
moves based on some distance thresholds? Any idea about the
pseudo-algorithm is welcome.

Thanks.

Le dim. 23 juin 2024 à 10:33, Alan Gauld via Tutor  a
écrit :

> On 22/06/2024 13:41, marc nicole wrote:
>
> > So, given the x,y,z coordinates of a target object and the offset x,y,z
> of
> > arms of a robot, what is a good algorithm to perform to grab the object
> > between the hands (either from both sides or from below all using both
> > hands).
> >
> > Specifically, my problem is applied to a NAO robot environment where I
> > retrieve a target object coordinates using the following code:
>
> This is almost entirely outside the Python domain and all within
> your 3rd party environment. Do they have a user forum or mailing
> list? You will probably get better results asking there?
>
> Another possibility is that you are using a Python wrapper around
> a C (or other language) library and there might be FAQs, fora or
> lists supporting that. If so you should be able to translate
> their examples to your Python code?
>
> In terms of generic solutions the only thing I can suggest that
> might help is to research collision detection algorithms.
> Wikipedia is likely a good starting point.
>
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
> http://www.amazon.com/author/alan_gauld
> Follow my photo-blog on Flickr at:
> http://www.flickr.com/photos/alangauldphotos
>
>
>
> ___
> Tutor maillist  -  tu...@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Decoding bytes to text strings in Python 2

2024-06-23 Thread Chris Angelico via Python-list
On Mon, 24 Jun 2024 at 10:18, MRAB via Python-list
 wrote:
> Tkinter in recent versions of Python can handle astral characters, at
> least back to Python 3.8, the oldest I have on my Windows PC.

Good to know, thanks! I was hoping that would be the case, but I don't
have a Windows system to check on, so I didn't want to speak without
facts.

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


Re: Decoding bytes to text strings in Python 2

2024-06-23 Thread MRAB via Python-list

On 2024-06-24 00:30, Chris Angelico via Python-list wrote:

On Mon, 24 Jun 2024 at 08:20, Rayner Lucas via Python-list
 wrote:


In article ,
ros...@gmail.com says...
>
> If you switch to a Linux system, it should work correctly, and you'll
> be able to migrate the rest of the way onto Python 3. Once you achieve
> that, you'll be able to operate on Windows or Linux equivalently,
> since Python 3 solved this problem. At least, I *think* it will; my
> current system has a Python 2 installed, but doesn't have tkinter
> (because I never bothered to install it), and it's no longer available
> from the upstream Debian repos, so I only tested it in the console.
> But the decoding certainly worked.

Thank you for the idea of trying it on a Linux system. I did so, and my
example code generated the error:

_tkinter.TclError: character U+1f40d is above the range (U+-U+)
allowed by Tcl

So it looks like the problem is ultimately due to a limitation of
Tcl/Tk.

Yep, that seems to be the case. Not sure if that's still true on a
more recent Python, but it does look like you won't get astral
characters in tkinter on the one you're using.


[snip]
Tkinter in recent versions of Python can handle astral characters, at 
least back to Python 3.8, the oldest I have on my Windows PC.

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


Re: Decoding bytes to text strings in Python 2

2024-06-23 Thread Chris Angelico via Python-list
On Mon, 24 Jun 2024 at 08:20, Rayner Lucas via Python-list
 wrote:
>
> In article ,
> ros...@gmail.com says...
> >
> > If you switch to a Linux system, it should work correctly, and you'll
> > be able to migrate the rest of the way onto Python 3. Once you achieve
> > that, you'll be able to operate on Windows or Linux equivalently,
> > since Python 3 solved this problem. At least, I *think* it will; my
> > current system has a Python 2 installed, but doesn't have tkinter
> > (because I never bothered to install it), and it's no longer available
> > from the upstream Debian repos, so I only tested it in the console.
> > But the decoding certainly worked.
>
> Thank you for the idea of trying it on a Linux system. I did so, and my
> example code generated the error:
>
> _tkinter.TclError: character U+1f40d is above the range (U+-U+)
> allowed by Tcl
>
> So it looks like the problem is ultimately due to a limitation of
> Tcl/Tk.
Yep, that seems to be the case. Not sure if that's still true on a
more recent Python, but it does look like you won't get astral
characters in tkinter on the one you're using.

> I'm still not sure why it doesn't give an error on Windows and

Because of the aforementioned weirdness of old (that is: pre-3.3)
Python versions on Windows. They were built to use a messy, buggy
hybrid of UCS-2 and UTF-16. Sometimes this got you around problems, or
at least masked them; but it wouldn't be reliable. That's why, in
Python 3.3, all that was fixed :)

> instead either works (when UTF-8 encoding is specified) or converts the
> out-of-range characters to ones it can display (when the encoding isn't
> specified). But now I know what the root of the problem is, I can deal
> with it appropriately (and my curiosity is at least partly satisfied).

Converting out-of-range characters is fairly straightforward, at least
as long as your Python interpreter is correctly built (so, Python 3,
or a Linux build of Python 2).

"".join(c if ord(c) < 65536 else "?" for c in text)

> This has given me a much better understanding of what I need to do in
> order to migrate to Python 3 and add proper support for non-ASCII
> characters, so I'm very grateful for your help!
>

Excellent. Hopefully all this mess is just a transitional state and
you'll get to something that REALLY works, soon!

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


Re: Decoding bytes to text strings in Python 2

2024-06-23 Thread Rayner Lucas via Python-list
In article , r...@zedat.fu-
berlin.de says...
> 
>   I didn't really do a super thorough deep dive on this,
>   but I'm just giving the initial impression without 
>   actually being familiar with Tkinter under Python 2,
>   so I might be wrong!
> 
>   The Text widget typically expects text in Tcl encoding,
>   which is usually UTF-8. 
> 
>   This is independent of the result returned by sys.get-
>   defaultencoding()! 
> 
>   If a UTF-8 string is inserted directly as a bytes object,
>   its code points will be displayed correctly by the Text 
>   widget as long as they are in the BMP (Basic Multilingual
>   Plane), as you already found out yourself.

Many thanks, you've helped me greatly in understanding what's happening. 
When I tried running my example code on a different system (Python 
2.7.18 on Linux, with Tcl/Tk 8.5), I got the error:

_tkinter.TclError: character U+1f40d is above the range (U+-U+) 
allowed by Tcl

So, as your reply suggests, the problem is ultimately a limitation of 
Tcl/Tk itself. Perhaps I should have spent more time studying the docs 
for that instead of puzzling over the details of character encodings in 
Python! I'm not sure why it doesn't give the same error on Windows, but 
at least now I know where the root of the issue is.

I am now much better informed about how to migrate the code I'm working 
on, so I am very grateful for your help.

Thanks,
Rayner
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Decoding bytes to text strings in Python 2

2024-06-23 Thread Rayner Lucas via Python-list
In article , 
ros...@gmail.com says...
> 
> If you switch to a Linux system, it should work correctly, and you'll
> be able to migrate the rest of the way onto Python 3. Once you achieve
> that, you'll be able to operate on Windows or Linux equivalently,
> since Python 3 solved this problem. At least, I *think* it will; my
> current system has a Python 2 installed, but doesn't have tkinter
> (because I never bothered to install it), and it's no longer available
> from the upstream Debian repos, so I only tested it in the console.
> But the decoding certainly worked.

Thank you for the idea of trying it on a Linux system. I did so, and my 
example code generated the error:

_tkinter.TclError: character U+1f40d is above the range (U+-U+) 
allowed by Tcl

So it looks like the problem is ultimately due to a limitation of 
Tcl/Tk. I'm still not sure why it doesn't give an error on Windows and 
instead either works (when UTF-8 encoding is specified) or converts the 
out-of-range characters to ones it can display (when the encoding isn't 
specified). But now I know what the root of the problem is, I can deal 
with it appropriately (and my curiosity is at least partly satisfied).

This has given me a much better understanding of what I need to do in 
order to migrate to Python 3 and add proper support for non-ASCII 
characters, so I'm very grateful for your help!

Thanks,
Rayner
-- 
https://mail.python.org/mailman/listinfo/python-list


How to go about a simple object grabbing in python (given coordinates of arms and objects)

2024-06-23 Thread marc nicole via Python-list
Hello to all of this magnificent community!

I have this problem I had already spent a few days on and still can't
figure out a proper solution.

So, given the x,y,z coordinates of a target object and the offset x,y,z of
arms of a robot, what is a good algorithm to perform to grab the object
between the hands (either from both sides or from below all using both
hands).

Specifically, my problem is applied to a NAO robot environment where I
retrieve a target object coordinates using the following code:

tracker_service= session.service("ALTracker")
xyz_pos = tracker_service.getTargetPosition(motion.FRAME_TORSO)


src:
http://doc.aldebaran.com/2-8/naoqi/motion/control-cartesian.html#motion-cartesian-effectors


Then I get to move the right arm towards nearby the object using the
following code:

effector = "RArm"

frame = motion.FRAME_TORSO
effector_offset =
almath.Transform(self.motion.getTransform(effector, frame, False))
effector_init_3d_position = almath.position3DFromTransform(
effector_offset)

target_3d_position = almath.Position3D(target_position)
move_3d = target_3d_position - effector_init_3d_position
moveTransform = almath.Transform.fromPosition(move_3d.x,
move_3d.y, move_3d.z)
target_transformer_list = list(moveTransform.toVector())
times = [2.0]
axis_mask_list = motion.AXIS_MASK_VEL
self.motion.transformInterpolations(effector, frame,
target_transformer_list, axis_mask_list, times).

src: 
http://doc.aldebaran.com/1-14/dev/python/examples/almath/index.html?highlight=offset
This question is specific to NAO environment but in general how to go
about this task? what is a most common algorithm used in this case? Do
I have to also get the side of the object in order to know where
exactly the arms should be placed?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [Tutor] How to go about a simple object grabbing in python (given coordinates of arms and objects)

2024-06-22 Thread marc nicole via Python-list
My code is just an attempt at the task, it is not exact as what relates to
the coordinates (e.g., doesn't account for the size of the object. I would
like to have a idea on the general approach to such problems (even a pseudo
code would do)

"Get the hands rapidly enough in the vicinity and then do some fine
coordinated motions to capture the object and then presumably move it."
seems to be a good approach indeed,
The grabbing with both hands code should be more precise.

Thanks for the help anyways!

Le sam. 22 juin 2024 à 23:04, ThreeBlindQuarks 
a écrit :

> Marc,
>
> Could you specify what is wrong with what you are doing? you show us code
> that uses an environment you point to that is largely outside of basic
> Python.
>
> There is no one way to get from point A to point B and various constraints
> you have not mentioned can apply. How many joints does the assemblage have
> and what are the limits and costs associated with each. Cam there be
> barriers along a route, including to the side where they may brush part of
> your equipment. Are other things moving (independently even) that may end
> up blocking.
>
> You seem to need both "hands" and presumably at the same time. So
> solutions can take that into account. You need to define what is meant by
> contacting the object to move and you don't want to approach it and hit
> with some speed.
>
> So, the problem may be in parts. Get the hands rapidly enough in the
> vicinity and then do some fine coordinated motions to capture the object
> and then presumably move it.
>
> If you could point to what code is not doing what is expected, someone who
> knows the details or is willing to learn, might help, If you want an
> overall algorithm, there may be some people could share but they may not
> easily translate into the package of sorts you are using.
>
> But the web site you point us to may well already contain examples of
> doing some aspects that you might learn from.
>
> For me, this is too detailed to focus on as I struggle to figure out how
> to move my hands to different parts of my keyboard while looking ...
>
> And that may be one variant of an algorithm where instead of trying to
> move all the way, you move art-way and LOOK where you are, then repeat.
>
>
> Sent with Proton Mail secure email.
>
> On Saturday, June 22nd, 2024 at 8:41 AM, marc nicole 
> wrote:
>
> > Hello to all of this magnificent community!
> >
> > I have this problem I had already spent a few days on and still can't
> > figure out a proper solution.
> >
> > So, given the x,y,z coordinates of a target object and the offset x,y,z
> of
> > arms of a robot, what is a good algorithm to perform to grab the object
> > between the hands (either from both sides or from below all using both
> > hands).
> >
> > Specifically, my problem is applied to a NAO robot environment where I
> > retrieve a target object coordinates using the following code:
> >
> > tracker_service= session.service("ALTracker")
> > xyz_pos = tracker_service.getTargetPosition(motion.FRAME_TORSO)
> >
> >
> > src:
> >
> http://doc.aldebaran.com/2-8/naoqi/motion/control-cartesian.html#motion-cartesian-effectors
> >
> >
> > Then I get to move the right arm towards nearby the object using the
> > following code:
> >
> > effector = "RArm"
> >
> > frame = motion.FRAME_TORSO
> > effector_offset =
> > almath.Transform(self.motion.getTransform(effector, frame, False))
> > effector_init_3d_position = almath.position3DFromTransform(
> > effector_offset)
> >
> > target_3d_position = almath.Position3D(target_position)
> > move_3d = target_3d_position - effector_init_3d_position
> > moveTransform = almath.Transform.fromPosition(move_3d.x,
> > move_3d.y, move_3d.z)
> > target_transformer_list = list(moveTransform.toVector())
> > times = [2.0]
> > axis_mask_list = motion.AXIS_MASK_VEL
> > self.motion.transformInterpolations(effector, frame,
> > target_transformer_list, axis_mask_list, times).
> >
> > src:
> http://doc.aldebaran.com/1-14/dev/python/examples/almath/index.html?highlight=offset
> > This question is specific to NAO environment but in general how to go
> > about this task? what is a most common algorithm used in this case? Do
> > I have to also get the side of the object in order to know where
> > exactly the arms should be placed?
> > ___
> > Tutor maillist - tu...@python.org
> > To unsubscribe or change subscription options:
> > https://mail.python.org/mailman/listinfo/tutor
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Decoding bytes to text strings in Python 2

2024-06-21 Thread Chris Angelico via Python-list
On Sat, 22 Jun 2024 at 03:28, Rayner Lucas via Python-list
 wrote:
> I'm curious about something I've encountered while updating a very old
> Tk app (originally written in Python 1, but I've ported it to Python 2
> as a first step towards getting it running on modern systems).
>
> I am using Python 2.7.18 on a Windows 10 system. If there's any other
> relevant information I should provide please let me know.

Unfortunately, you're running into one of the most annoying problems
from Python 2 and Windows: "narrow builds". You don't actually have
proper Unicode support. You have a broken implementation that works
for UCS-2 but doesn't actually support astral characters.

If you switch to a Linux system, it should work correctly, and you'll
be able to migrate the rest of the way onto Python 3. Once you achieve
that, you'll be able to operate on Windows or Linux equivalently,
since Python 3 solved this problem. At least, I *think* it will; my
current system has a Python 2 installed, but doesn't have tkinter
(because I never bothered to install it), and it's no longer available
from the upstream Debian repos, so I only tested it in the console.
But the decoding certainly worked.

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


Decoding bytes to text strings in Python 2

2024-06-21 Thread Rayner Lucas via Python-list


I'm curious about something I've encountered while updating a very old 
Tk app (originally written in Python 1, but I've ported it to Python 2 
as a first step towards getting it running on modern systems). The app 
downloads emails from a POP server and displays them. At the moment, the 
code is completely unaware of character encodings (which is something I 
plan to fix), and I have found that I don't understand what Python is 
doing when no character encoding is specified.

To demonstrate, I have written this short example program that displays 
a variety of UTF-8 characters to check whether they are decoded 
properly:

 Example Code 
import Tkinter as tk

window = tk.Tk()

mytext = """
  \xc3\xa9 LATIN SMALL LETTER E WITH ACUTE
  \xc5\x99 LATIN SMALL LETTER R WITH CARON
  \xc4\xb1 LATIN SMALL LETTER DOTLESS I
  \xef\xac\x84 LATIN SMALL LIGATURE FFL
  \xe2\x84\x9a DOUBLE-STRUCK CAPITAL Q
  \xc2\xbd VULGAR FRACTION ONE HALF
  \xe2\x82\xac EURO SIGN
  \xc2\xa5 YEN SIGN
  \xd0\x96 CYRILLIC CAPITAL LETTER ZHE
  \xea\xb8\x80 HANGUL SYLLABLE GEUL
  \xe0\xa4\x93 DEVANAGARI LETTER O
  \xe5\xad\x97 CJK UNIFIED IDEOGRAPH-5B57
  \xe2\x99\xa9 QUARTER NOTE
  \xf0\x9f\x90\x8d SNAKE
  \xf0\x9f\x92\x96 SPARKLING HEART
"""

mytext = mytext.decode(encoding="utf-8")
greeting = tk.Label(text=mytext)
greeting.pack()

window.mainloop()
 End Example Code 

This works exactly as expected, with all the characters displaying 
correctly.

However, if I comment out the line 'mytext = mytext.decode
(encoding="utf-8")', the program still displays *almost* everything 
correctly. All of the characters appear correctly apart from the two 
four-byte emoji characters at the end, which instead display as four 
characters. For example, the "SNAKE" character actually displays as:
U+00F0 LATIN SMALL LETTER ETH
U+FF9F HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK
U+FF90 HALFWIDTH KATAKANA LETTER MI
U+FF8D HALFWIDTH KATAKANA LETTER HE

What's Python 2 doing here? sys.getdefaultencoding() returns 'ascii', 
but it's clearly not attempting to display the bytes as ASCII (or 
cp1252, or ISO-8859-1). How is it deciding on some sort of almost-but-
not-quite UTF-8 decoding?

I am using Python 2.7.18 on a Windows 10 system. If there's any other 
relevant information I should provide please let me know.

Many thanks,
Rayner
-- 
https://mail.python.org/mailman/listinfo/python-list


glibc strverscmp called from python

2024-06-20 Thread vallor via Python-list
So there's been discussion in comp.lang.c and comp.unix.shell
about doing a "versionsort(3)" type sort on a list
of parameters.  glibc offers strverscmp(3) for this type
of sort, and here I am posting a q&d python program to expose
that to its sort routine for commentary and future reference.

Caveat:  I know just enough python to be dangerous -- wrote
this using ChatGPT.  It is a learning experience, comments
very much appreciated.

 - -%<- -

#!/usr/bin/python3

import ctypes
from ctypes import c_char_p, c_int
import os
import sys

# Load the C standard library (libc)
libc = ctypes.CDLL("libc.so.6")

# Define the prototype of strverscmp
# int strverscmp (const char *s1, const char *s2)
libc.strverscmp.argtypes = [c_char_p, c_char_p]
libc.strverscmp.restype = c_int

# Define a comparison function for Python sorting
def version_compare(x, y):
return libc.strverscmp(x.encode('utf-8'), y.encode('utf-8'))

# Define a key function for sorting
def version_key(s):
class K:
def __init__(self, s):
self.s = s
def __lt__(self, other):
return version_compare(self.s, other.s) < 0
def __gt__(self, other):
return version_compare(self.s, other.s) > 0
def __eq__(self, other):
return version_compare(self.s, other.s) == 0
def __le__(self, other):
return version_compare(self.s, other.s) <= 0
def __ge__(self, other):
return version_compare(self.s, other.s) >= 0
def __ne__(self, other):
return version_compare(self.s, other.s) != 0
return K(s)

# Function to escape special characters
def shell_escape(s):
return s.replace(" ", "\\ ").replace("\n", "\\n").replace("\t", "\\t")

# Parse command-line arguments
args = sys.argv[1:]

# Sort the list using the version key
sorted_args = sorted(args, key=version_key)

# Print each sorted, escaped value on a new line
for arg in sorted_args:
print(shell_escape(arg))

 - -%<- -

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


Re: in Python: (101 102 103 201 202 203 301 302 303 401 402 403 )

2024-06-18 Thread Peter J. Holzer via Python-list
On 2024-06-14 06:10:06 -, candycanearter07 via Python-list wrote:
> Phil Carmody  wrote at 12:01 this Thursday (GMT):
> > I'd say you can't beat the verbosity, or lack thereof of just plain 
> > zsh/bash:
> >   $ echo {1,2,3,4}0{1,2,3}
> >   101 102 103 201 202 203 301 302 303 401 402 403
> 
> 
> I /think/ you can replace it with {1...4} and {1...3}? I know there is
> some syntax for "range of numbers" but I can't remember it exactly.

Only two dots, not three:

% echo {1..4}0{1..3}
101 102 103 201 202 203 301 302 303 401 402 403

hp

-- 
   _  | Peter J. Holzer| Story must make more sense than reality.
|_|_) ||
| |   | h...@hjp.at |-- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |   challenge!"


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


Re: Suggested python feature: allowing except in context maneger

2024-06-17 Thread j via Python-list


On 2024-06-13 23:49, Cameron Simpson via Python-list wrote:
On 13Jun2024 19:44, dieter.mau...@online.de  
wrote:

Why not use:
```
try:
 with open()...
   ...
except FileNotFoundError:
 ...
```


This is exactly what the OP was expressing dissatisfaction with.

I'm -1 on the idea myself - not every combination of things needs 
additional syntactic support, and doing stuff like merging an `except` 
with a `wtih` is bound to introduce some weird corner case, 
complicating its semantics.


I agree. If python allowed statement lambdas you could write what you 
want above within the language (albeit a bit clumsily). It's very handy.


jan



Cheers,
Cameron Simpson 

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


Re: Suggested python feature: allowing except in context maneger

2024-06-16 Thread Albert-Jan Roskam via Python-list
 The example exception is not what bothers me. The syntax change is
 nowhere near as useful as `with` and context managers. They provide an
 excellent idiom for resource usage and release.

 Your suggestion complicates the `with` statement and brings only a tiny
 indentation reduction over the `with`-inside-`try` idiom. It brings no
 semantic changes or new features.

   
   I also don't see the added value. If you desperately want to get rid of an
   indentation level, you could use an except
   hook. https://docs.python.org/3/library/sys.html#sys.excepthook
-- 
https://mail.python.org/mailman/listinfo/python-list


  1   2   3   4   5   6   7   8   9   10   >