Re: Assistance Request - Issue with Installing 'pip' despite Python 3.10 Installation

2023-06-07 Thread Thomas Passin via Python-list

On 6/7/2023 6:28 PM, Eryk Sun wrote:

On 6/7/23, Thomas Passin via Python-list  wrote:


You have by now seen several responses, and the one most likely to be
helpful is to run pip with

py -m pip


That won't be of any help if pip isn't installed. By default, Python's
installer attempts to install pip by running the ensurepip package,
but sometimes it fails. It can help to try to manually run ensurepip
in the shell. For example:

 py -m ensurepip --default-pip --upgrade --verbose


Yes, but why should anyone besides the OP think pip isn't installed? Let 
him try py -m pip.  If pip isn't installed he will see something like


C:\Users\tom\AppData\Local\Programs\Python\Python311\python.exe: No 
module named pip


Then ensurepip should take care of it. Otherwise it's just that he 
hasn't tried the one thing that will certainly work as expected if pip 
is present.

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


Re: Match statement with literal strings

2023-06-07 Thread Jason Friedman via Python-list
>
> The bytecode compiler doesn't know that you intend RANGE
> to be a constant -- it thinks it's a variable to bind a
> value to.
>
> To make this work you need to find a way to refer to the
> value that isn't just a bare name. One way would be to
> define your constants using an enum:
>
> class Options(Enum):
> RANGE = "RANGE"
> MANDATORY = "MANDATORY"
>
> match stuff:
> case Options.RANGE:
>...
> case Options.MANDATORY:
>...
>

Got it, thank you.

On Wed, Jun 7, 2023 at 6:01 PM Greg Ewing via Python-list <
python-list@python.org> wrote:

> On 8/06/23 10:18 am, Jason Friedman wrote:
> > SyntaxError: name capture 'RANGE' makes remaining patterns unreachable
>
> The bytecode compiler doesn't know that you intend RANGE
> to be a constant -- it thinks it's a variable to bind a
> value to.
>
> To make this work you need to find a way to refer to the
> value that isn't just a bare name. One way would be to
> define your constants using an enum:
>
> class Options(Enum):
> RANGE = "RANGE"
> MANDATORY = "MANDATORY"
>
> match stuff:
> case Options.RANGE:
>...
> case Options.MANDATORY:
>...
>
> --
> Greg
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Match statement with literal strings

2023-06-07 Thread Chris Angelico via Python-list
On Thu, 8 Jun 2023 at 08:19, Jason Friedman via Python-list
 wrote:
>
> This gives the expected results:
>
> with open(data_file, newline="") as reader:
> csvreader = csv.DictReader(reader)
> for row in csvreader:
> #print(row)
> match row[RULE_TYPE]:
> case "RANGE":
> print("range")
> case "MANDATORY":
> print("mandatory")
> case _:
> print("nothing to do")
>
> This:
>
> RANGE = "RANGE"
> MANDATORY = "MANDATORY"
> with open(data_file, newline="") as reader:
> csvreader = csv.DictReader(reader)
> for row in csvreader:
> #print(row)
> match row[RULE_TYPE]:
> case RANGE:
> print("range")
> case MANDATORY:
> print("mandatory")
> case _:
> print("nothing to do")
>
> Gives (and I don't understand why):
>
> SyntaxError: name capture 'RANGE' makes remaining patterns unreachable

It's being as clear as it can. When you say "case RANGE:", that is not
a literal, that is a name capture. Check the docs and examples for
case statements for more details.

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


Re: Match statement with literal strings

2023-06-07 Thread Greg Ewing via Python-list

On 8/06/23 10:18 am, Jason Friedman wrote:

SyntaxError: name capture 'RANGE' makes remaining patterns unreachable


The bytecode compiler doesn't know that you intend RANGE
to be a constant -- it thinks it's a variable to bind a
value to.

To make this work you need to find a way to refer to the
value that isn't just a bare name. One way would be to
define your constants using an enum:

class Options(Enum):
   RANGE = "RANGE"
   MANDATORY = "MANDATORY"

match stuff:
   case Options.RANGE:
  ...
   case Options.MANDATORY:
  ...

--
Greg


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


Re: Assistance Request - Issue with Installing 'pip' despite Python 3.10 Installation

2023-06-07 Thread Eryk Sun via Python-list
On 6/7/23, Thomas Passin via Python-list  wrote:
>
> You have by now seen several responses, and the one most likely to be
> helpful is to run pip with
>
> py -m pip

That won't be of any help if pip isn't installed. By default, Python's
installer attempts to install pip by running the ensurepip package,
but sometimes it fails. It can help to try to manually run ensurepip
in the shell. For example:

py -m ensurepip --default-pip --upgrade --verbose
-- 
https://mail.python.org/mailman/listinfo/python-list


Match statement with literal strings

2023-06-07 Thread Jason Friedman via Python-list
This gives the expected results:

with open(data_file, newline="") as reader:
csvreader = csv.DictReader(reader)
for row in csvreader:
#print(row)
match row[RULE_TYPE]:
case "RANGE":
print("range")
case "MANDATORY":
print("mandatory")
case _:
print("nothing to do")

This:

RANGE = "RANGE"
MANDATORY = "MANDATORY"
with open(data_file, newline="") as reader:
csvreader = csv.DictReader(reader)
for row in csvreader:
#print(row)
match row[RULE_TYPE]:
case RANGE:
print("range")
case MANDATORY:
print("mandatory")
case _:
print("nothing to do")

Gives (and I don't understand why):

SyntaxError: name capture 'RANGE' makes remaining patterns unreachable
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Assistance Request - Issue with Installing 'pip' despite Python 3.10 Installation

2023-06-07 Thread Thomas Passin via Python-list

On 6/7/2023 10:54 AM, Florian Guilbault via Python-list wrote:

Dear Python Technical Team,

I hope this email finds you well. I am reaching out to you today to seek
assistance with an issue I am facing regarding the installation of 'pip'
despite my numerous attempts to resolve the problem.

Recently, I performed installation, uninstallation, and even repair
operations on Python 3.10 on my computer. However, I have noticed that
'pip' has never been installed successfully. When I check via the command
prompt, I receive the following error: "'pip' is not recognized as an
internal or external command, operable program, or batch file."

I have tried several approaches to resolve this issue. I have verified that
the PATH environment variable is correctly configured to include the path
to the Python Scripts directory. I have also attempted to run the
'get-pip.py' installation script from the command line, but it did not work
either.

I am aware that 'pip' is typically installed automatically with Python, but
I am encountering this persistent difficulty. Therefore, I would like to
request your assistance and expertise in resolving this 'pip' installation
issue. I would like to be able to use 'pip' to manage my Python packages
efficiently.

I am open to any suggestions and steps you can provide to help me resolve
this problem. Please note that I am a user on the Windows operating system.

Thank you sincerely for your attention and support. I eagerly await your
guidance to resolve this situation.


You have by now seen several responses, and the one most likely to be 
helpful is to run pip with


py -m pip

I would like to suggest some ways you can make it more likely that  you 
will get useful suggestions in the future.  Basically, please fill in 
details about your situation.


1. Say what operating system your computer is running.  All the 
responses so far have assumed that it is some version of Windows.  This 
may or may not be correct.  We can infer it in this case from the 
message you reported ("'pip' is not recognized as an internal or 
external command, operable program, or batch file."), but you should say 
so that we don't need to guess.


2. Since this question is about your python installation, say how you 
installed it, since there are several possibilities.  For example, you 
may have used the installer from python.org, you may have installed it 
from the Microsoft store, etc.  These different installations are not 
always the same.


3.  When you wrote that you "verified that the PATH environment variable 
is correctly configured to include the path to the Python Scripts 
directory", tell us what that PATH actually is, not just that it is 
"correct".  We don't know if your idea of "correct" matches ours.


4.  Say how you tried to run programs that appeared to fail - running 
"python" in a console may launch a different version from the one you 
expect.  On Windows, running "py" will run the most recent one.


BTW, my own python.org installation of Python 3.11 on Windows 10 does 
not include a get-pip.exe or a get-pip.py in its Python311\Scripts 
directory (not that it was needed).


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


Re: Assistance Request - Issue with Installing 'pip' despite Python 3.10 Installation

2023-06-07 Thread Mats Wichmann via Python-list

On 6/7/23 10:08, MRAB via Python-list wrote:

On 2023-06-07 15:54, Florian Guilbault via Python-list wrote:

Dear Python Technical Team,

I hope this email finds you well. I am reaching out to you today to seek
assistance with an issue I am facing regarding the installation of 'pip'
despite my numerous attempts to resolve the problem.

Recently, I performed installation, uninstallation, and even repair
operations on Python 3.10 on my computer. However, I have noticed that
'pip' has never been installed successfully. When I check via the command
prompt, I receive the following error: "'pip' is not recognized as an
internal or external command, operable program, or batch file."

I have tried several approaches to resolve this issue. I have verified 
that

the PATH environment variable is correctly configured to include the path
to the Python Scripts directory. 


I'm assuming you checked - say, with Explorer - that pip.exe really is 
where you think it is?
Anyway,  if you ask a Windows shell (cmd) to locate it, and it doesn't, 
then your PATH is not set up correctly after all.


where pip

should give you back a path that ends witn ...\Scripts\pip.exe

That said, the suggestions already given are on point.  Running pip as a 
module (rather than as a standalone command) assures that it's 
associated with the Python you want it associated with.  In today's 
world, a lot of developer systems end up with multiple Python 
installations (*), and you don't want to use a pip that is bound to the 
wrong one, or the next email will be "I installed foo module but my 
Python fails to import it".


(*) You can have different Python versions for compat checking, you can 
have project-specific virtualenvs, you can have Pythons that come 
bundled with a subsystem like Conda, etc.



On Windows, it's recommended to use the Python Launcher and the pip module:

py -m pip install whatever



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


Re: Assistance Request - Issue with Installing 'pip' despite Python 3.10 Installation

2023-06-07 Thread MRAB via Python-list

On 2023-06-07 15:54, Florian Guilbault via Python-list wrote:

Dear Python Technical Team,

I hope this email finds you well. I am reaching out to you today to seek
assistance with an issue I am facing regarding the installation of 'pip'
despite my numerous attempts to resolve the problem.

Recently, I performed installation, uninstallation, and even repair
operations on Python 3.10 on my computer. However, I have noticed that
'pip' has never been installed successfully. When I check via the command
prompt, I receive the following error: "'pip' is not recognized as an
internal or external command, operable program, or batch file."

I have tried several approaches to resolve this issue. I have verified that
the PATH environment variable is correctly configured to include the path
to the Python Scripts directory. I have also attempted to run the
'get-pip.py' installation script from the command line, but it did not work
either.

I am aware that 'pip' is typically installed automatically with Python, but
I am encountering this persistent difficulty. Therefore, I would like to
request your assistance and expertise in resolving this 'pip' installation
issue. I would like to be able to use 'pip' to manage my Python packages
efficiently.

I am open to any suggestions and steps you can provide to help me resolve
this problem. Please note that I am a user on the Windows operating system.

Thank you sincerely for your attention and support. I eagerly await your
guidance to resolve this situation.


On Windows, it's recommended to use the Python Launcher and the pip module:

py -m pip install whatever

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


Re: Assistance Request - Issue with Installing 'pip' despite Python 3.10 Installation

2023-06-07 Thread Barry via Python-list


> On 7 Jun 2023, at 16:39, Florian Guilbault via Python-list 
>  wrote:
> 
> Dear Python Technical Team,
> 
> I hope this email finds you well. I am reaching out to you today to seek
> assistance with an issue I am facing regarding the installation of 'pip'
> despite my numerous attempts to resolve the problem.
> 
> Recently, I performed installation, uninstallation, and even repair
> operations on Python 3.10 on my computer. However, I have noticed that
> 'pip' has never been installed successfully. When I check via the command
> prompt, I receive the following error: "'pip' is not recognized as an
> internal or external command, operable program, or batch file."
> 
> I have tried several approaches to resolve this issue. I have verified that
> the PATH environment variable is correctly configured to include the path
> to the Python Scripts directory. I have also attempted to run the
> 'get-pip.py' installation script from the command line, but it did not work
> either.
> 
> I am aware that 'pip' is typically installed automatically with Python, but
> I am encountering this persistent difficulty. Therefore, I would like to
> request your assistance and expertise in resolving this 'pip' installation
> issue. I would like to be able to use 'pip' to manage my Python packages
> efficiently.
> 
> I am open to any suggestions and steps you can provide to help me resolve
> this problem. Please note that I am a user on the Windows operating system.
> 
> Thank you sincerely for your attention and support. I eagerly await your
> guidance to resolve this situation.

You can run pip like this, that works with needing to mess with your PATH.

py -m pip

Barty


> 
> Best regards,
> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 

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


Using pydal for standalone scripts

2023-06-07 Thread Tobiah via Python-list

I am looking into creating a database abstraction library using pydal
and mysql as the engine.  I noticed that I have to specify a 'folder'
with the connection string to tell pydal where to save "table files".

So I'll have hundreds of different databases and install this library
on many machines.  Do I need to standardize a place for these files and
make sure that directory exists on every machine that uses the library?
It seems rather cumbersome.  I mean, couldn't pydal have just put
this information into the database in its own private table?


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


Assistance Request - Issue with Installing 'pip' despite Python 3.10 Installation

2023-06-07 Thread Florian Guilbault via Python-list
Dear Python Technical Team,

I hope this email finds you well. I am reaching out to you today to seek
assistance with an issue I am facing regarding the installation of 'pip'
despite my numerous attempts to resolve the problem.

Recently, I performed installation, uninstallation, and even repair
operations on Python 3.10 on my computer. However, I have noticed that
'pip' has never been installed successfully. When I check via the command
prompt, I receive the following error: "'pip' is not recognized as an
internal or external command, operable program, or batch file."

I have tried several approaches to resolve this issue. I have verified that
the PATH environment variable is correctly configured to include the path
to the Python Scripts directory. I have also attempted to run the
'get-pip.py' installation script from the command line, but it did not work
either.

I am aware that 'pip' is typically installed automatically with Python, but
I am encountering this persistent difficulty. Therefore, I would like to
request your assistance and expertise in resolving this 'pip' installation
issue. I would like to be able to use 'pip' to manage my Python packages
efficiently.

I am open to any suggestions and steps you can provide to help me resolve
this problem. Please note that I am a user on the Windows operating system.

Thank you sincerely for your attention and support. I eagerly await your
guidance to resolve this situation.

Best regards,
-- 
https://mail.python.org/mailman/listinfo/python-list


[Python-announce] [RELEASE] Python 3.11.4, 3.10.12, 3.9.17, 3.8.17, 3.7.17, and 3.12.0 beta 2 are now available

2023-06-07 Thread Łukasz Langa
Greetings! Time for another combined release of six separate versions of Python!

 
Before
 you scroll away to the download links

Please test the 3.12 beta! Downloading it and trying it out helps us a lot in 
ensuring Python 3.12.0 will be as polished as possible.

We welcome 3.10 to the prestigious club of security-only releases. It’s 
officially an old version of Python now! If you haven’t rewritten all your 
if:elif:else:s with pattern matching yet, are you even still writing Python?

At the same time, it looks like 3.7 is reaching end-of-life. Unless another 
security release happens in June, 3.7.17 will be the final release of Python 
3.7. I mean, now that I typed it out for all you to read, I’m sure I jinxed it. 
But in case I didn’t, I would like to thank Ned Deily for serving as the 
release manager of Python 3.6 and Python 3.7. He was my mentor as Release 
Manager, and continues serving Python as the provider of Mac installers for new 
releases. Thank you, Ned!

Speaking of installers, Steve Dower used to be the sole provider of Windows 
installers for Python releases for years now. His secret was a well-automated 
Azure pipeline that let him build, sign, and publish releases with minimal 
manual effort. Now he extended the power to press the blue “Run pipeline” 
button to more members of the team. Thank you, Steve! This is an important bus 
factor increment. In fact, the Windows installers for both 3.12.0b2 and 3.11.4 
were made by meinitiated by me 
.
 If there’s anything wrong with them, well, I guess that means I pressed the 
button wrong.

 
Security
 fixes in today’s releases

Updating is recommended due to security content:

3.7 - 3.12: gh-103142 : The 
version of OpenSSL used in Windows and Mac installers has been upgraded to 
1.1.1u to address CVE-2023-2650, CVE-2023-0465, CVE-2023-0466, CVE-2023-0464, 
as well as CVE-2023-0286, CVE-2022-4303, and CVE-2022-4303 fixed previously in 
1.1.1t (gh-101727).
3.7 - 3.11: gh-102153 : 
urllib.parse.urlsplit() now strips leading C0 control and space characters 
following the specification for URLs defined by WHATWG in response to 
CVE-2023-24329.
3.7 - 3.11: gh-99889 : Fixed a 
security in flaw in uu.decode() that could allow for directory traversal based 
on the input if no out_file was specified.
3.7 - 3.11: gh-104049 : Do not 
expose the local on-disk location in directory indexes produced by 
http.client.SimpleHTTPRequestHandler.
3.7 - 3.11: gh-101283 : 
subprocess.Popen now uses a safer approach to find cmd.exe when launching with 
shell=True.
3.8 - 3.11: gh-103935 : 
trace.__main__ now uses io.open_code() for files to be executed instead of raw 
open().
3.8 - 3.11: gh-102953 : The 
extraction methods in tarfile, and shutil.unpack_archive(), have a new 
filterargument that allows limiting tar features than may be surprising or 
dangerous, such as creating files outside the destination directory. See 
Extraction filters 
 for details.
3.9: gh-102126 : Fixed a 
deadlock at shutdown when clearing thread states if any finalizer tries to 
acquire the runtime head lock.
3.9: gh-100892 : Fixed a crash 
due to a race while iterating over thread states in clearing threading.local.
Python 3.12.0 beta 2

Get it here: 3.12.0b2 
116 new commits since 3.12.0 beta 1.

Python 3.11.4

Get it here: 3.11.4 
233 new commits.

Python 3.10.12

Get it here: 3.10.12 
Security-only release with no binaries. 20 new commits.

Python 3.9.17

Get it here: 3.9.17 
Security-only release with no binaries. 26 commits.

Python 3.8.17

Get it here: 3.8.17 
Security-only release with no binaries. 24 commits.

Python 3.7.17

Get it here as it might be the last release of 3.7 ever 
:
3.7.17 
Security-only release with no binaries. 21 commits.

[RELEASE] Python 3.11.4, 3.10.12, 3.9.17, 3.8.17, 3.7.17, and 3.12.0 beta 2 are now available

2023-06-07 Thread Łukasz Langa via Python-list
Greetings! Time for another combined release of six separate versions of Python!

 
Before
 you scroll away to the download links

Please test the 3.12 beta! Downloading it and trying it out helps us a lot in 
ensuring Python 3.12.0 will be as polished as possible.

We welcome 3.10 to the prestigious club of security-only releases. It’s 
officially an old version of Python now! If you haven’t rewritten all your 
if:elif:else:s with pattern matching yet, are you even still writing Python?

At the same time, it looks like 3.7 is reaching end-of-life. Unless another 
security release happens in June, 3.7.17 will be the final release of Python 
3.7. I mean, now that I typed it out for all you to read, I’m sure I jinxed it. 
But in case I didn’t, I would like to thank Ned Deily for serving as the 
release manager of Python 3.6 and Python 3.7. He was my mentor as Release 
Manager, and continues serving Python as the provider of Mac installers for new 
releases. Thank you, Ned!

Speaking of installers, Steve Dower used to be the sole provider of Windows 
installers for Python releases for years now. His secret was a well-automated 
Azure pipeline that let him build, sign, and publish releases with minimal 
manual effort. Now he extended the power to press the blue “Run pipeline” 
button to more members of the team. Thank you, Steve! This is an important bus 
factor increment. In fact, the Windows installers for both 3.12.0b2 and 3.11.4 
were made by meinitiated by me 
.
 If there’s anything wrong with them, well, I guess that means I pressed the 
button wrong.

 
Security
 fixes in today’s releases

Updating is recommended due to security content:

3.7 - 3.12: gh-103142 : The 
version of OpenSSL used in Windows and Mac installers has been upgraded to 
1.1.1u to address CVE-2023-2650, CVE-2023-0465, CVE-2023-0466, CVE-2023-0464, 
as well as CVE-2023-0286, CVE-2022-4303, and CVE-2022-4303 fixed previously in 
1.1.1t (gh-101727).
3.7 - 3.11: gh-102153 : 
urllib.parse.urlsplit() now strips leading C0 control and space characters 
following the specification for URLs defined by WHATWG in response to 
CVE-2023-24329.
3.7 - 3.11: gh-99889 : Fixed a 
security in flaw in uu.decode() that could allow for directory traversal based 
on the input if no out_file was specified.
3.7 - 3.11: gh-104049 : Do not 
expose the local on-disk location in directory indexes produced by 
http.client.SimpleHTTPRequestHandler.
3.7 - 3.11: gh-101283 : 
subprocess.Popen now uses a safer approach to find cmd.exe when launching with 
shell=True.
3.8 - 3.11: gh-103935 : 
trace.__main__ now uses io.open_code() for files to be executed instead of raw 
open().
3.8 - 3.11: gh-102953 : The 
extraction methods in tarfile, and shutil.unpack_archive(), have a new 
filterargument that allows limiting tar features than may be surprising or 
dangerous, such as creating files outside the destination directory. See 
Extraction filters 
 for details.
3.9: gh-102126 : Fixed a 
deadlock at shutdown when clearing thread states if any finalizer tries to 
acquire the runtime head lock.
3.9: gh-100892 : Fixed a crash 
due to a race while iterating over thread states in clearing threading.local.
Python 3.12.0 beta 2

Get it here: 3.12.0b2 
116 new commits since 3.12.0 beta 1.

Python 3.11.4

Get it here: 3.11.4 
233 new commits.

Python 3.10.12

Get it here: 3.10.12 
Security-only release with no binaries. 20 new commits.

Python 3.9.17

Get it here: 3.9.17 
Security-only release with no binaries. 26 commits.

Python 3.8.17

Get it here: 3.8.17 
Security-only release with no binaries. 24 commits.

Python 3.7.17

Get it here as it might be the last release of 3.7 ever 
:
3.7.17 
Security-only release with no binaries. 21 commits.