Re: Couldn't install numpy on Python 2.7

2024-06-13 Thread Ethan Furman via Python-list

Hey, everyone!

I believe the original question has been answered, and tempers seem to be flaring in sub-threads, so let's call this 
thread done and move on to other interesting topics.


Thank you for your support!

--
~Ethan~
Moderator
--
https://mail.python.org/mailman/listinfo/python-list


Re: Couldn't install numpy on Python 2.7

2024-06-13 Thread Chris Green via Python-list
Chris Angelico  wrote:
> On Thu, 13 Jun 2024 at 10:58,  wrote:
> >
> > Chris,
> >
> > You seem to have perceived an insult that I remain unaware of.
> 
> If you're not aware that you're saying this, then don't say it.
> 
Er, um, that really makes no sense! :-)

How can one not say something that one isn't aware of saying?

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


Re: Couldn't install numpy on Python 2.7

2024-06-12 Thread Chris Angelico via Python-list
On Thu, 13 Jun 2024 at 10:58,  wrote:
>
> Chris,
>
> You seem to have perceived an insult that I remain unaware of.

If you're not aware that you're saying this, then don't say it.

> I looked up FUD and sharply disagree with suggestions I am trying to somehow
> cause Fear, Uncertainty or Doubt. I simply asked if another such update ...
> as a hypothetical. Had I asked what impact Quantum Computers might have on
> existing languages, would that also be FUD, or just a speculation in a
> discussion.

What DID you intend by your comments? Were you trying to imply that
work spent upgrading to Python 3 would have to be redone any day now
when this hypothetical massively-incompatible Python 4 is released? Or
what? What WERE you trying to say?

If you don't understand how damaging it can be to say that sort of
thing, **don't say it**. Otherwise, expect responses like this.

I *detest* the attitude that you can make vague disparaging comments
and then hide behind claims that you had no idea how damaging you were
being.

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


RE: Couldn't install numpy on Python 2.7

2024-06-12 Thread AVI GROSS via Python-list
Chris,

You seem to have perceived an insult that I remain unaware of.

I have no special knowledge, like you do, of plans made for changes to the
pthon language and implementation.

I was asking a hypothetical question about what some users would do if
python came out with a newer major version. I have seen people often wait
until some software that tries to get updated too frequently makes multiple
updates and then finally give in and skip the intermediates.

I wondered if something like a version 4.0 might get people still using
version 2 might finally come around and also if some version 3 users would
not be thrilled with something not stable enough.

I have no favorite ideas here and can see a balance between adding features
or fixing flaws and on the other side, not discomfiting many and especially
when in many cases, the original people who wrote software are no longer
there nor budgets to pay for changes.

I looked up FUD and sharply disagree with suggestions I am trying to somehow
cause Fear, Uncertainty or Doubt. I simply asked if another such update ...
as a hypothetical. Had I asked what impact Quantum Computers might have on
existing languages, would that also be FUD, or just a speculation in a
discussion.

Either way, I am taking any further discussion along these lines offline and
will not continue here.

-Original Message-
From: Python-list  On
Behalf Of Chris Angelico via Python-list
Sent: Wednesday, June 12, 2024 7:23 PM
To: python-list@python.org
Subject: Re: Couldn't install numpy on Python 2.7

On Thu, 13 Jun 2024 at 09:20,  wrote:
> My point was that version 4 COULD HAPPEN one day and I meant INCOMPATIBLE
> version not 4. Obviously we can make a version 4 that is not incompatible
> too.

This is still FUD. Back your words with something, or stop trying to
imply that there's another incompatible change just around the corner.

Do you realise how insulting you are being to the developers of Python
by these implications?

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

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


Re: Couldn't install numpy on Python 2.7

2024-06-12 Thread Chris Angelico via Python-list
On Thu, 13 Jun 2024 at 09:20,  wrote:
> My point was that version 4 COULD HAPPEN one day and I meant INCOMPATIBLE
> version not 4. Obviously we can make a version 4 that is not incompatible
> too.

This is still FUD. Back your words with something, or stop trying to
imply that there's another incompatible change just around the corner.

Do you realise how insulting you are being to the developers of Python
by these implications?

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


RE: Couldn't install numpy on Python 2.7

2024-06-12 Thread AVI GROSS via Python-list
Chris,

I don't want to get off message and debate whether my "jokes" are jokes, let
alone funny. Obviously, they often aren't.

What I meant by joking here does seem relevant. As the years pass, there can
come a time when it is suggested that a language (any language including
python) is no longer useful to many in the community as it has not kept up
with changes in the industry or whatever. Suggestions are made for changes
and additions that that not be backward compatible. They can be somewhat
minor things like new keywords that have not been reserved and where
programs that exist might be scanned for use of that keyword, and you simply
replace those names with was_keyword or something and the programs will
generally  run.  But there can be major changes too and there can be a
choice to just create a new language that has some similarities to python 3
(or PERL version whatever) or just name it the same but a version higher
much like has happened.

My point was that version 4 COULD HAPPEN one day and I meant INCOMPATIBLE
version not 4. Obviously we can make a version 4 that is not incompatible
too.

I have experience in other languages where disconnects happen at various
levels. Some functions in a collection such as a package are removed perhaps
to replace them with a more abstract version that does much more. Do you
remove the old one immediately or do you make a new name for the new one and
perhaps in some way mark the old one for deprecation with a pointer to the
new one to be used as soon as reasonable? I have seen many approaches. I
have seen entire packages yanked. I have seen parts that used to be in the
distribution as if built-in and then taken out and vice versa.

The point is you do not need a 4.0 to be incompatible. The incompatibility,
or need to change, can happen anytime when you are importing things like
numpy which is released whenever they want to and is not part of the python
distribution. Also, as we have seen at times, other modules you may have
imported, in some languages, can mask names you are using in your program
that you may not even be aware are there. Much can go wrong with software
and keeping current can also give you problems when something released may
have inadvertent changes or bugs.

So much of our code is voluntary and as noted earlier, some python
variants/distributions simply may not have anyone interested in keeping them
up to date. You as a user, take your chances.


-Original Message-
From: Python-list  On
Behalf Of Chris Angelico via Python-list
Sent: Wednesday, June 12, 2024 5:52 PM
To: python-list@python.org
Subject: Re: Couldn't install numpy on Python 2.7

On Thu, 13 Jun 2024 at 07:36,  wrote:
> But if the goal was to deprecate python 2 and in some sense phase it out,
it
> is perhaps not working well for some. Frankly, issuing so many updates
like
> 2.7 and including backporting of new features has helped make it possible
to
> delay any upgrade.

The goal was to improve Python. I don't think anyone's ever tried to
"kill off" Python 2 - not in the sense of stopping people from using
it - but there haven't been any changes, not even security fixes, in
over four years.

> And, yes, I was KIDDING about python 4. I am simply suggesting that there
> may well be a time that another shift happens that may require another
> effort to get people on board a new and perhaps incompatible setup.

Kidding, eh? It sure sounded like you were trying to imply that there
would inevitably be another major breaking change. It definitely
smelled like FUD.

Maybe your jokes just aren't funny.

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

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


Re: Couldn't install numpy on Python 2.7

2024-06-12 Thread Oscar Benjamin via Python-list
On Wed, 12 Jun 2024 at 23:52, Greg Ewing via Python-list
 wrote:
> On 13/06/24 10:09 am, Chris Angelico wrote:
>  > So if anyone
>  > actually does need to use pip with Python 2.7, they probably need to
>  > set up a local server
>
> You should also be able to download a .tar.gz from PyPI and use pip
> to install that. Although you'll have to track down the dependencies
> yourself in that case.

It is almost certainly better to download the wheel (.whl) file rather
than the sdist (.tar.gz) file. Building NumPy from source needs not
just compilers etc but also you first need to build/install a BLAS
library.

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


Re: Couldn't install numpy on Python 2.7

2024-06-12 Thread Chris Angelico via Python-list
On Thu, 13 Jun 2024 at 08:46, Oscar Benjamin via Python-list
 wrote:
> I don't know much about SSL and related networking things especially
> on Windows. I would be surprised if pip on old Python can't install
> from current PyPI though. I imagine that something strange has
> happened like a new version of pip running on an old version of Python
> or old Python on new OS (or old PyCharm...).
>
> There is no problem using Python 2.7 with pip and PyPI on this Linux
> machine but I guess it has a newer SSL library provided by the OS:

Sadly, I would NOT be surprised if this is indeed a problem on
Windows. You're exactly right - on Linux, it can use a newer SSL
library from the OS. Of course, this does assume that you've updated
your OS, which is far from a guarantee, but since this has security
implications there's a good chance you can update it while retaining a
legacy system.

On Thu, 13 Jun 2024 at 08:51, Greg Ewing via Python-list
 wrote:
> On 13/06/24 10:09 am, Chris Angelico wrote:
>  > So if anyone
>  > actually does need to use pip with Python 2.7, they probably need to
>  > set up a local server
>
> You should also be able to download a .tar.gz from PyPI and use pip
> to install that. Although you'll have to track down the dependencies
> yourself in that case.

Also a possibility; in my opinion, losing dependency management is too
big a cost, so I would be inclined to set up a local server. But then,
I would be using a newer SSL library and not have the problem in the
first place.

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


Re: Couldn't install numpy on Python 2.7

2024-06-12 Thread Greg Ewing via Python-list

On 13/06/24 4:31 am, avi.e.gr...@gmail.com wrote:

It seems Microsoft is having a problem where something lik 2/3 of Windows
users have not upgraded from Windows 10 after many years


At least Python 3 is a clear improvement over Python 2 in many ways.
Whereas the only thing Microsoft seems to have done with Windows in
recent times is change it in ways that nobody wants, so there is
understandable resistance to upgrading even if it's possible.

On 13/06/24 10:09 am, Chris Angelico wrote:
> So if anyone
> actually does need to use pip with Python 2.7, they probably need to
> set up a local server

You should also be able to download a .tar.gz from PyPI and use pip
to install that. Although you'll have to track down the dependencies
yourself in that case.

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


Re: Couldn't install numpy on Python 2.7

2024-06-12 Thread Oscar Benjamin via Python-list
On Wed, 12 Jun 2024 at 23:11, Chris Angelico via Python-list
 wrote:
>
> On Thu, 13 Jun 2024 at 07:57, Oscar Benjamin via Python-list
>  wrote:
> > They are seeing a warning that explicitly says "You can upgrade to a
> > newer version of Python to solve this". I don't know whether that SSL
> > warning is directly connected to pip not finding any versions of numpy
> > but with the available information so far that seems like the first
> > thing to consider.
>
> I think it is; AIUI, with an ancient SSL library, pip is unable to
> download packages safely from the current pypi server. So if anyone
> actually does need to use pip with Python 2.7, they probably need to
> set up a local server, using older encryption protocols (which should
> therefore NOT be made accessible to the internet). Since pip can't
> contact the upstream pypi, there's no available numpy for it to
> install.

I don't know much about SSL and related networking things especially
on Windows. I would be surprised if pip on old Python can't install
from current PyPI though. I imagine that something strange has
happened like a new version of pip running on an old version of Python
or old Python on new OS (or old PyCharm...).

There is no problem using Python 2.7 with pip and PyPI on this Linux
machine but I guess it has a newer SSL library provided by the OS:

$ pip install numpy
DEPRECATION: Python 2.7 reached the end of its life on January 1st,
2020. Please upgrade your Python as Python 2.7 is no longer
maintained. pip 21.0 will drop support for Python 2.7 in January 2021.
More details about Python 2 support in pip can be found at
https://pip.pypa.io/en/latest/development/release-process/#python-2-support
pip 21.0 will remove support for this functionality.
Collecting numpy
  Downloading numpy-1.16.6-cp27-cp27mu-manylinux1_x86_64.whl (17.0 MB)
 || 17.0 MB 14.3 MB/s
Installing collected packages: numpy
Successfully installed numpy-1.16.6

If it is actually the case that pip on Python 2.7 (on Windows) cannot
download from PyPI then an easier option rather than creating a local
server would just be to download the numpy wheels from PyPI using a
browser:

  https://pypi.org/project/numpy/1.15.4/#files

Then you can do

   pip install .\numpy-1.15.4-cp27-none-win_amd64.whl

Using a newer version of Python is still my primary suggestion though.

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


Re: Couldn't install numpy on Python 2.7

2024-06-12 Thread Chris Angelico via Python-list
On Thu, 13 Jun 2024 at 07:57, Oscar Benjamin via Python-list
 wrote:
> They are seeing a warning that explicitly says "You can upgrade to a
> newer version of Python to solve this". I don't know whether that SSL
> warning is directly connected to pip not finding any versions of numpy
> but with the available information so far that seems like the first
> thing to consider.

I think it is; AIUI, with an ancient SSL library, pip is unable to
download packages safely from the current pypi server. So if anyone
actually does need to use pip with Python 2.7, they probably need to
set up a local server, using older encryption protocols (which should
therefore NOT be made accessible to the internet). Since pip can't
contact the upstream pypi, there's no available numpy for it to
install.

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


Re: Couldn't install numpy on Python 2.7

2024-06-12 Thread Oscar Benjamin via Python-list
On Wed, 12 Jun 2024 at 22:38, AVI GROSS via Python-list
 wrote:
>
> The discussion though was about a specific OP asking if they can fix their
> problem. One solution being suggested is to fix a deeper problem and simply
> make their code work with a recent version of python 3.

The OP has not replied with any explanation as to why they are using
Python 2.7 and has not said whether they have any existing code that
only works with Python 2.7. It is unclear at this point whether there
is any reason that they shouldn't just install a newer version of
Python.

They are seeing a warning that explicitly says "You can upgrade to a
newer version of Python to solve this". I don't know whether that SSL
warning is directly connected to pip not finding any versions of numpy
but with the available information so far that seems like the first
thing to consider.

It is entirely reasonable to start by suggesting to use a newer
version of Python until some reason is given for not doing that.

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


Re: Couldn't install numpy on Python 2.7

2024-06-12 Thread Chris Angelico via Python-list
On Thu, 13 Jun 2024 at 07:36,  wrote:
> But if the goal was to deprecate python 2 and in some sense phase it out, it
> is perhaps not working well for some. Frankly, issuing so many updates like
> 2.7 and including backporting of new features has helped make it possible to
> delay any upgrade.

The goal was to improve Python. I don't think anyone's ever tried to
"kill off" Python 2 - not in the sense of stopping people from using
it - but there haven't been any changes, not even security fixes, in
over four years.

> And, yes, I was KIDDING about python 4. I am simply suggesting that there
> may well be a time that another shift happens that may require another
> effort to get people on board a new and perhaps incompatible setup.

Kidding, eh? It sure sounded like you were trying to imply that there
would inevitably be another major breaking change. It definitely
smelled like FUD.

Maybe your jokes just aren't funny.

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


RE: Couldn't install numpy on Python 2.7

2024-06-12 Thread AVI GROSS via Python-list
Chris,

Since you misunderstood, my statement was that making an incompatible set of
changes to create Python 3 in the first place was a decision made by some
and perhaps not one that thrilled others who already had an embedded base of
programs or ones in the pipeline that would need much work to become
comparable.

And, of course, users of a program who continued to use python 2, also have
to find a way to ...

But if the goal was to deprecate python 2 and in some sense phase it out, it
is perhaps not working well for some. Frankly, issuing so many updates like
2.7 and including backporting of new features has helped make it possible to
delay any upgrade.

And, yes, I was KIDDING about python 4. I am simply suggesting that there
may well be a time that another shift happens that may require another
effort to get people on board a new and perhaps incompatible setup. I have
seen things like that happen in multiple phases including phases where the
new tools are not an upgrade, but brand new. An example might be if
accompany decided to switch to another existing language because they want
better error detection and faster execution or new features that may take
forever to arrive in what they are using or that supply various services by
humans to help them.

The discussion though was about a specific OP asking if they can fix their
problem. One solution being suggested is to fix a deeper problem and simply
make their code work with a recent version of python 3. But another solution
could be to step backward to a version of python 2 that still has numpy
support, or as was suggested, find out what other modules they are using are
interfering with the program being satisfied with the last version of numpy
being used and perhaps find a way to get ...

In the long run, though, continuing with python 2 will likely cause ever
more such headaches if you want the latest and greatest of things like
numpy.


-Original Message-
From: Python-list  On
Behalf Of Chris Angelico via Python-list
Sent: Wednesday, June 12, 2024 2:00 PM
To: python-list@python.org
Subject: Re: Couldn't install numpy on Python 2.7

On Thu, 13 Jun 2024 at 03:41, AVI GROSS via Python-list
 wrote:
>
> Change is hard even when it may be necessary.
>
> The argument often is about whether some things are necessary or not.
>
> Python made a decision but clearly not a unanimous one.

What decision? To not release any new versions of Python 2? That isn't
actually the OP's problem here - the Python interpreter runs just
fine. But there's no numpy build for the OP's hardware and Python 2.7.

So if you want to complain about Python 2.7 being dead, all you have
to do is go through all of the popular packages and build binaries for
all modern computers. If that sounds easy, go ahead and do it; if it
sounds hard, realise that open source is not a democracy, and you
can't demand that other people do more and more and more unpaid work
just because you can't be bothered upgrading your code.

> My current PC was not upgradable because of the new hardware requirement
> Microsoft decided was needed for Windows 11.

Yes, and that's a good reason to switch to Linux for the older computer.

> I mention this in the context of examples of why even people who are
fairly
> knowledgeable do not feel much need to fix what does not feel broken.

It doesn't feel broken, right up until it does. The OP has discovered
that it *IS* broken. Whining that it doesn't "feel broken" is nonsense
when it is, in fact, not working.

> When is Python 4 coming?

Is this just another content-free whine, or are you actually curious
about the planned future of Python? If the latter, there is **PLENTY**
of information out there and I don't need to repeat it here.

Please don't FUD.

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

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


Re: Couldn't install numpy on Python 2.7

2024-06-12 Thread Chris Angelico via Python-list
On Thu, 13 Jun 2024 at 06:55, Thomas Passin via Python-list
 wrote:
> The project cannot move to a Python-3 compatible version because Jython
> 3.xx doesn't exist and may never exist.  The saving grace is that my
> project doesn't have to use packages like numpy, scipy, and so forth.

Exactly. If you don't need to ALSO use something newer, there's
nothing stopping you from continuing with the old version. And that's
fine! As long as you're okay with not getting updates, you're welcome
to do whatever you like - including running Windows 98 on an ancient
PC and editing your documents on that. (Yes, I know someone who did
that, long after Win 98 was dead to most of us.)

> Thunderbird and everything else worked perfectly for me during that
> week.  True, there were a few Windows-only programs I missed, but I used
> other similar programs even if I didn't like them as much.

It's true. And there ARE solutions to that, although it's a bit rough
trying to run them on low hardware (Wine works nicely for some
programs, less so for others; VirtualBox is really not gonna be happy
with a small fraction of your limited RAM). But if your needs are
simple, even a crazily low-end system is sufficient.

> It's amazing
> how little resources Linux installs need, even with a GUI.  Of course,
> 4GB RAM is limiting whether you are on Linux or Windows - you can't
> avoid shuffling all those GUI bits around - but with a little care it
> worked great.  And with the external SSD the laptop was a lot snappier
> than it ever was when it was new.

One of the big differences with Linux is that you have a choice of
desktop environments, from "none" (just boot straight into a terminal)
on up. Some of them are a bit of a compromise in terms of how well you
can get your work done, but let's say you had an even MORE ancient
system with maybe one gig of memory... I'd rather have a super-light
desktop environment even if it doesn't have everything I'm normally
accustomed to!

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


Re: Couldn't install numpy on Python 2.7

2024-06-12 Thread Thomas Passin via Python-list

On 6/12/2024 1:59 PM, Chris Angelico via Python-list wrote:

On Thu, 13 Jun 2024 at 03:41, AVI GROSS via Python-list
 wrote:


Change is hard even when it may be necessary.

The argument often is about whether some things are necessary or not.

Python made a decision but clearly not a unanimous one.


What decision? To not release any new versions of Python 2? That isn't
actually the OP's problem here - the Python interpreter runs just
fine. But there's no numpy build for the OP's hardware and Python 2.7.

So if you want to complain about Python 2.7 being dead, all you have
to do is go through all of the popular packages and build binaries for
all modern computers. If that sounds easy, go ahead and do it; if it
sounds hard, realise that open source is not a democracy, and you
can't demand that other people do more and more and more unpaid work
just because you can't be bothered upgrading your code.


I support a Tomcat project that has some java code and most of the code 
is for Jython 2.7.  Jython 2.7 is approximately on a par with Python 
2.7.  Any Python-only code from the standard library will probably run, 
but of course any C extensions cannot.  The nice thing about using 
Jython in a java environment is that it can call any java object, and 
java code can call Jython objects and their methods.


The project cannot move to a Python-3 compatible version because Jython 
3.xx doesn't exist and may never exist.  The saving grace is that my 
project doesn't have to use packages like numpy, scipy, and so forth. 
Also, the project is very mature and almost certainly won't need to 
create functionality such packages would enable.  It would be nice to be 
able to use some newer parts of the standard library, but there it is. 
Jython does support "from __future__ import" and I make use of that for 
the print function and the like.



My current PC was not upgradable because of the new hardware requirement
Microsoft decided was needed for Windows 11.


Yes, and that's a good reason to switch to Linux for the older computer.


I have a 2012-vintage laptop that in modern terms has a very small 
supply of RAM and a very slow hard drive. When my newer Windows 10 
computer was going to be out of service for a while, I put a Linux 
distro on an external SSD and copied things I needed to work on to it, 
including my Thunderbird email profile directory.


Thunderbird and everything else worked perfectly for me during that 
week.  True, there were a few Windows-only programs I missed, but I used 
other similar programs even if I didn't like them as much.  It's amazing 
how little resources Linux installs need, even with a GUI.  Of course, 
4GB RAM is limiting whether you are on Linux or Windows - you can't 
avoid shuffling all those GUI bits around - but with a little care it 
worked great.  And with the external SSD the laptop was a lot snappier 
than it ever was when it was new.



I mention this in the context of examples of why even people who are fairly
knowledgeable do not feel much need to fix what does not feel broken.


It doesn't feel broken, right up until it does. The OP has discovered
that it *IS* broken. Whining that it doesn't "feel broken" is nonsense
when it is, in fact, not working.


When is Python 4 coming?


Is this just another content-free whine, or are you actually curious
about the planned future of Python? If the latter, there is **PLENTY**
of information out there and I don't need to repeat it here.

Please don't FUD.

ChrisA


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


Re: Couldn't install numpy on Python 2.7

2024-06-12 Thread Chris Angelico via Python-list
On Thu, 13 Jun 2024 at 03:41, AVI GROSS via Python-list
 wrote:
>
> Change is hard even when it may be necessary.
>
> The argument often is about whether some things are necessary or not.
>
> Python made a decision but clearly not a unanimous one.

What decision? To not release any new versions of Python 2? That isn't
actually the OP's problem here - the Python interpreter runs just
fine. But there's no numpy build for the OP's hardware and Python 2.7.

So if you want to complain about Python 2.7 being dead, all you have
to do is go through all of the popular packages and build binaries for
all modern computers. If that sounds easy, go ahead and do it; if it
sounds hard, realise that open source is not a democracy, and you
can't demand that other people do more and more and more unpaid work
just because you can't be bothered upgrading your code.

> My current PC was not upgradable because of the new hardware requirement
> Microsoft decided was needed for Windows 11.

Yes, and that's a good reason to switch to Linux for the older computer.

> I mention this in the context of examples of why even people who are fairly
> knowledgeable do not feel much need to fix what does not feel broken.

It doesn't feel broken, right up until it does. The OP has discovered
that it *IS* broken. Whining that it doesn't "feel broken" is nonsense
when it is, in fact, not working.

> When is Python 4 coming?

Is this just another content-free whine, or are you actually curious
about the planned future of Python? If the latter, there is **PLENTY**
of information out there and I don't need to repeat it here.

Please don't FUD.

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


RE: Couldn't install numpy on Python 2.7

2024-06-12 Thread AVI GROSS via Python-list
Change is hard even when it may be necessary.

The argument often is about whether some things are necessary or not.

Python made a decision but clearly not a unanimous one.

My current PC was not upgradable because of the new hardware requirement
Microsoft decided was needed for Windows 11. I bought a new one a while back
and turned it on in another room and then set it aside because replacing the
current one in the current position will be a pain, especially with getting
all my wires and so on, and since I do not want to use a full copy of my
data including many obsolete things, that will be another pain to get what I
need, if I can remember. Complicating issues also include licenses for
things in fixed amounts and the likelihood of messing up the
hardware/software I have that records shows from cable to my hard disk,
possibly needing to buy a new one.

I mention this in the context of examples of why even people who are fairly
knowledgeable do not feel much need to fix what does not feel broken.

I have wondered if instead of doing what Microsoft wants, if maybe switching
to Linux of some kinds makes as much sense. I suspect some may simply
upgrade to an Apple product.

And think of all the PC's that may effectively be discarded as they may not
even be usable if donated.

We live in a rapidly developing age and hence one with regularly and
irregularly scheduled rounds of obsolescence.

When is Python 4 coming?

-Original Message-
From: Python-list  On
Behalf Of MRAB via Python-list
Sent: Wednesday, June 12, 2024 12:56 PM
To: python-list@python.org
Subject: Re: Couldn't install numpy on Python 2.7

On 2024-06-12 17:31, AVI GROSS via Python-list wrote:
> I am sure there is inertia to move from an older product and some people
> need a reason like this where the old becomes untenable.
> 
> It seems Microsoft is having a problem where something lik 2/3 of Windows
> users have not upgraded from Windows 10 after many years and have set a
> deadline in a year or so for stopping updates. In that case, hardware was
a
> concern for some as Windows 11 did not work on their machines. With
> upgrading python, the main concern is having to get someone to examine old
> code and try to make it compatible.
> 
In the case of Windows, my PC is over 10 years old yet performs 
perfectly well for my needs. It can't run Windows 11. Therefore, I'm in 
the process of migrating to Linux, and I still have over a year to 
achieve that before support ends.

> But anyone doing new code in Python 2 in recent years should ...
> 
Indeed...

> -Original Message-
> From: Python-list 
On
> Behalf Of Gordinator via Python-list
> Sent: Wednesday, June 12, 2024 10:19 AM
> To: python-list@python.org
> Subject: Re: Couldn't install numpy on Python 2.7
> 
> On 12/06/2024 12:30, marc nicole wrote:
>> I am trying to install numpy library on Python 2.7.15 in PyCharm but the
>> error message I get is:
>> 
>> ERROR: Could not find a version that satisfies the requirement numpy
(from
>>> versions: none)
>>> ERROR: No matching distribution found for numpy
>>> c:\python27\lib\site-packages\pip\_vendor\urllib3\util\ssl_.py:164:
>>> InsecurePlatformWarning: A true SSLContext object is not available. This
>>> prevents urllib3 fro
>>> m configuring SSL appropriately and may cause certain SSL connections to
>>> fail. You can upgrade to a newer version of Python to solve this. For
> more
>>> information, see
>>>
https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
>>>InsecurePlatformWarning,
>> 
>> 
>> Any clues?
> 
> Why are you using Python 2? Come on, it's been 16 years. Ya gotta move
> on at some point.

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

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


Re: Couldn't install numpy on Python 2.7

2024-06-12 Thread MRAB via Python-list

On 2024-06-12 17:31, AVI GROSS via Python-list wrote:

I am sure there is inertia to move from an older product and some people
need a reason like this where the old becomes untenable.

It seems Microsoft is having a problem where something lik 2/3 of Windows
users have not upgraded from Windows 10 after many years and have set a
deadline in a year or so for stopping updates. In that case, hardware was a
concern for some as Windows 11 did not work on their machines. With
upgrading python, the main concern is having to get someone to examine old
code and try to make it compatible.

In the case of Windows, my PC is over 10 years old yet performs 
perfectly well for my needs. It can't run Windows 11. Therefore, I'm in 
the process of migrating to Linux, and I still have over a year to 
achieve that before support ends.



But anyone doing new code in Python 2 in recent years should ...


Indeed...


-Original Message-
From: Python-list  On
Behalf Of Gordinator via Python-list
Sent: Wednesday, June 12, 2024 10:19 AM
To: python-list@python.org
Subject: Re: Couldn't install numpy on Python 2.7

On 12/06/2024 12:30, marc nicole wrote:

I am trying to install numpy library on Python 2.7.15 in PyCharm but the
error message I get is:

ERROR: Could not find a version that satisfies the requirement numpy (from

versions: none)
ERROR: No matching distribution found for numpy
c:\python27\lib\site-packages\pip\_vendor\urllib3\util\ssl_.py:164:
InsecurePlatformWarning: A true SSLContext object is not available. This
prevents urllib3 fro
m configuring SSL appropriately and may cause certain SSL connections to
fail. You can upgrade to a newer version of Python to solve this. For

more

information, see
https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
   InsecurePlatformWarning,



Any clues?


Why are you using Python 2? Come on, it's been 16 years. Ya gotta move
on at some point.


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


RE: Couldn't install numpy on Python 2.7

2024-06-12 Thread AVI GROSS via Python-list
I am sure there is inertia to move from an older product and some people
need a reason like this where the old becomes untenable.

It seems Microsoft is having a problem where something lik 2/3 of Windows
users have not upgraded from Windows 10 after many years and have set a
deadline in a year or so for stopping updates. In that case, hardware was a
concern for some as Windows 11 did not work on their machines. With
upgrading python, the main concern is having to get someone to examine old
code and try to make it compatible. 

But anyone doing new code in Python 2 in recent years should ...

-Original Message-
From: Python-list  On
Behalf Of Gordinator via Python-list
Sent: Wednesday, June 12, 2024 10:19 AM
To: python-list@python.org
Subject: Re: Couldn't install numpy on Python 2.7

On 12/06/2024 12:30, marc nicole wrote:
> I am trying to install numpy library on Python 2.7.15 in PyCharm but the
> error message I get is:
> 
> ERROR: Could not find a version that satisfies the requirement numpy (from
>> versions: none)
>> ERROR: No matching distribution found for numpy
>> c:\python27\lib\site-packages\pip\_vendor\urllib3\util\ssl_.py:164:
>> InsecurePlatformWarning: A true SSLContext object is not available. This
>> prevents urllib3 fro
>> m configuring SSL appropriately and may cause certain SSL connections to
>> fail. You can upgrade to a newer version of Python to solve this. For
more
>> information, see
>> https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
>>InsecurePlatformWarning,
> 
> 
> Any clues?

Why are you using Python 2? Come on, it's been 16 years. Ya gotta move 
on at some point.
-- 
https://mail.python.org/mailman/listinfo/python-list

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


Re: Couldn't install numpy on Python 2.7

2024-06-12 Thread Gordinator via Python-list

On 12/06/2024 12:30, marc nicole wrote:

I am trying to install numpy library on Python 2.7.15 in PyCharm but the
error message I get is:

ERROR: Could not find a version that satisfies the requirement numpy (from

versions: none)
ERROR: No matching distribution found for numpy
c:\python27\lib\site-packages\pip\_vendor\urllib3\util\ssl_.py:164:
InsecurePlatformWarning: A true SSLContext object is not available. This
prevents urllib3 fro
m configuring SSL appropriately and may cause certain SSL connections to
fail. You can upgrade to a newer version of Python to solve this. For more
information, see
https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
   InsecurePlatformWarning,



Any clues?


Why are you using Python 2? Come on, it's been 16 years. Ya gotta move 
on at some point.

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


Re: Couldn't install numpy on Python 2.7

2024-06-12 Thread Chris Angelico via Python-list
On Wed, 12 Jun 2024 at 21:32, marc nicole via Python-list
 wrote:
>
> I am trying to install numpy library on Python 2.7.15 in PyCharm but the
> error message I get is:
>
> You can upgrade to a newer version of Python to solve this.

The answer is right there in the error message.

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


Couldn't install numpy on Python 2.7

2024-06-12 Thread marc nicole via Python-list
I am trying to install numpy library on Python 2.7.15 in PyCharm but the
error message I get is:

ERROR: Could not find a version that satisfies the requirement numpy (from
> versions: none)
> ERROR: No matching distribution found for numpy
> c:\python27\lib\site-packages\pip\_vendor\urllib3\util\ssl_.py:164:
> InsecurePlatformWarning: A true SSLContext object is not available. This
> prevents urllib3 fro
> m configuring SSL appropriately and may cause certain SSL connections to
> fail. You can upgrade to a newer version of Python to solve this. For more
> information, see
> https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
>   InsecurePlatformWarning,


Any clues?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: upgrade of pip on my python 2.7 version

2023-09-28 Thread Thomas Passin via Python-list

On 9/28/2023 9:23 AM, Zuri Shaddai Kuchipudi via Python-list wrote:

On Wednesday, 27 September 2023 at 23:33:02 UTC+2, Chris Angelico wrote:

On Thu, 28 Sept 2023 at 07:27, Mats Wichmann via Python-list
 wrote:


Upgrading to Python 3 is the best answer... except when it isn't. If
you want to convert a small project it's usually not too hard; and using
a conversion tool can work well.

Just remember that Python 2.7.18, the very last version of Python 2,
was released in 2020 and has not changed since. There are not even
security patches being released (at least, not from python.org - but
if you're using a different distribution of Python, you are also quite
possibly using their package manager rather than pip). Staying on a
version of Python that hasn't had new features since 2010 and hasn't
had bug fixes since 2020 is going to become increasingly problematic.

Convert your code. Pay the price in development time now and then reap
the benefits, rather than paying the price when you run into a massive
issue somewhere down the track and there's no options left to you.

Convert while you still have the luxury of running the old code.

ChrisA

but how do i convert it chris just downloading the python version 3 will solve 
my issue? and what about the changes


You have to modify your existing Python code.  It's often easy to do. 
There is the tool that tries to convert from Python 2 to Python 3; you 
may need to do some extra work after that.  Depending on the code you 
may even be able to make it work with both Python 2.7 and 3.x.  Often 
the biggest change is to print statements:


Python 2:
print a, b, c

Python3:
print(a, b, c)

If you are very unlucky, your code will depend on some package that has 
never been ported to Python 3.  But that would be unusual.


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


Re: upgrade of pip on my python 2.7 version

2023-09-28 Thread Zuri Shaddai Kuchipudi via Python-list
On Wednesday, 27 September 2023 at 23:33:02 UTC+2, Chris Angelico wrote:
> On Thu, 28 Sept 2023 at 07:27, Mats Wichmann via Python-list
>  wrote: 
> > 
> > Upgrading to Python 3 is the best answer... except when it isn't. If 
> > you want to convert a small project it's usually not too hard; and using 
> > a conversion tool can work well.
> Just remember that Python 2.7.18, the very last version of Python 2, 
> was released in 2020 and has not changed since. There are not even 
> security patches being released (at least, not from python.org - but 
> if you're using a different distribution of Python, you are also quite 
> possibly using their package manager rather than pip). Staying on a 
> version of Python that hasn't had new features since 2010 and hasn't 
> had bug fixes since 2020 is going to become increasingly problematic. 
> 
> Convert your code. Pay the price in development time now and then reap 
> the benefits, rather than paying the price when you run into a massive 
> issue somewhere down the track and there's no options left to you. 
> 
> Convert while you still have the luxury of running the old code. 
> 
> ChrisA
but how do i convert it chris just downloading the python version 3 will solve 
my issue? and what about the changes 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: upgrade of pip on my python 2.7 version

2023-09-27 Thread Chris Angelico via Python-list
On Thu, 28 Sept 2023 at 07:27, Mats Wichmann via Python-list
 wrote:
>
> Upgrading to Python 3 is the best answer... except when it isn't.  If
> you want to convert a small project it's usually not too hard; and using
> a conversion tool can work well.

Just remember that Python 2.7.18, the very last version of Python 2,
was released in 2020 and has not changed since. There are not even
security patches being released (at least, not from python.org - but
if you're using a different distribution of Python, you are also quite
possibly using their package manager rather than pip). Staying on a
version of Python that hasn't had new features since 2010 and hasn't
had bug fixes since 2020 is going to become increasingly problematic.

Convert your code. Pay the price in development time now and then reap
the benefits, rather than paying the price when you run into a massive
issue somewhere down the track and there's no options left to you.

Convert while you still have the luxury of running the old code.

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


Re: upgrade of pip on my python 2.7 version

2023-09-27 Thread Mats Wichmann via Python-list

On 9/27/23 14:02, Zuri Shaddai Kuchipudi via Python-list wrote:


Why it's trying to select an incompatible version when you ask to
upgrade is not something I'd like to speculate on, for me personally
that's a surprise. Maybe something else you did before?

Also make sure you're using a pip that matches your Python. It's usually
safer if you invoke it as:

python -m pip install --upgrade pip

(or whatever the precise name of your Python 2 interpreter actually is)

the code that i want to run and all the libraries are written for python 2 but 
i have seen a video where the person showed the 2to3 pip method in which it 
rewrites the code in python 3 and shows all the necessary changes.


Upgrading to Python 3 is the best answer... except when it isn't.  If 
you want to convert a small project it's usually not too hard; and using 
a conversion tool can work well.


If you have libraries "not under your control" expect a lot more work.

You can upgrade pip to the latest available version for Python 2.7 - 
will take some research, I don't know what that version might be.


Or you could try this:

https://bootstrap.pypa.io/pip/2.7/get-pip.py
If you were using a Linux distro, you probably don't want to mess with 
the "system pip" which is usually set up to understand details of how 
that distro's Python is packaged.  It looks like you're on Windows by 
the paths in your original message, so that should be okay.


Or... you could just ignore the message suggesting you upgrade pip, and 
proceed, hoping things will stay working as they are.

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


Re: upgrade of pip on my python 2.7 version

2023-09-27 Thread Zuri Shaddai Kuchipudi via Python-list
On Wednesday, 27 September 2023 at 21:32:53 UTC+2, Mats Wichmann wrote:
> On 9/27/23 05:17, Zuri Shaddai Kuchipudi via Python-list wrote: 
> > hello everyone this the error that im getting while trying to install and 
> > upgrade pip on what is the solution for it? 
> > 
> > C:\repository\pst-utils-pc-davinci-simulator>pip install 
> > You are using pip version 7.0.1, however version 23.2.1 is available. 
> > You should consider upgrading via the 'pip install --upgrade pip' command. 
> > You must give at least one requirement to install (see "pip help install") 
> > 
> > C:\repository\pst-utils-pc-davinci-simulator>pip install --upgrade pip 
> > You are using pip version 7.0.1, however version 23.2.1 is available. 
> > You should consider upgrading via the 'pip install --upgrade pip' command. 
> > Collecting pip 
> > Using cached 
> > https://files.pythonhosted.org/packages/ba/19/e63fb4e0d20e48bd2167bb7e857abc0e21679e24805ba921a224df8977c0/pip-23.2.1.tar.gz
> >  
> > Complete output from command python setup.py egg_info: 
> > Traceback (most recent call last): 
> > File "", line 20, in  
> > File "c:\users\kuchipz\appdata\local\temp\pip-build-gc4ekm\pip\setup.py", 
> > line 7 
> > def read(rel_path: str) -> str: 
> > ^ 
> > SyntaxError: invalid syntax
> PyPI *should* be returning a compatible version of pip to upgrade to. 
> pip itself has long since dropped support for 2.7, and the version 
> you're trying to force is pretty clear: 
> 
> pip 23.2.1 
> 
> Meta 
> License: MIT License (MIT) 
> Author: The pip developers 
> Requires: Python >=3.7 
> ... 
> Classifiers 
> Development Status 
> 5 - Production/Stable 
> Intended Audience 
> Developers 
> License 
> OSI Approved :: MIT License 
> Programming Language 
> Python 
> Python :: 3 
> Python :: 3 :: Only 
> ... 
> 
> So "don't do that". 
> 
> Why it's trying to select an incompatible version when you ask to 
> upgrade is not something I'd like to speculate on, for me personally 
> that's a surprise. Maybe something else you did before? 
> 
> Also make sure you're using a pip that matches your Python. It's usually 
> safer if you invoke it as: 
> 
> python -m pip install --upgrade pip 
> 
> (or whatever the precise name of your Python 2 interpreter actually is)
the code that i want to run and all the libraries are written for python 2 but 
i have seen a video where the person showed the 2to3 pip method in which it 
rewrites the code in python 3 and shows all the necessary changes. 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: upgrade of pip on my python 2.7 version

2023-09-27 Thread Mats Wichmann via Python-list

On 9/27/23 05:17, Zuri Shaddai Kuchipudi via Python-list wrote:

hello everyone this the error that im getting while trying to install and 
upgrade pip on what is the solution for it?

C:\repository\pst-utils-pc-davinci-simulator>pip install
You are using pip version 7.0.1, however version 23.2.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
You must give at least one requirement to install (see "pip help install")

C:\repository\pst-utils-pc-davinci-simulator>pip install --upgrade pip
You are using pip version 7.0.1, however version 23.2.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting pip
   Using cached 
https://files.pythonhosted.org/packages/ba/19/e63fb4e0d20e48bd2167bb7e857abc0e21679e24805ba921a224df8977c0/pip-23.2.1.tar.gz
 Complete output from command python setup.py egg_info:
 Traceback (most recent call last):
   File "", line 20, in 
   File 
"c:\users\kuchipz\appdata\local\temp\pip-build-gc4ekm\pip\setup.py", line 7
 def read(rel_path: str) -> str:
  ^
 SyntaxError: invalid syntax


PyPI *should* be returning a compatible version of pip to upgrade to. 
pip itself has long since dropped support for 2.7, and the version 
you're trying to force is pretty clear:


pip 23.2.1

Meta
License: MIT License (MIT)
Author: The pip developers
Requires: Python >=3.7
...
Classifiers
Development Status
5 - Production/Stable
Intended Audience
Developers
License
OSI Approved :: MIT License
Programming Language
Python
Python :: 3
Python :: 3 :: Only
...

So "don't do that".

Why it's trying to select an incompatible version when you ask to 
upgrade is not something I'd like to speculate on, for me personally 
that's a surprise.  Maybe something else you did before?


Also make sure you're using a pip that matches your Python. It's usually 
safer if you invoke it as:


python -m pip install --upgrade pip

(or whatever the precise name of your Python 2 interpreter actually is)

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


Re: upgrade of pip on my python 2.7 version

2023-09-27 Thread Chris Angelico via Python-list
On Thu, 28 Sept 2023 at 01:16, Zuri Shaddai Kuchipudi via Python-list
 wrote:
>
> hello everyone this the error that im getting while trying to install and 
> upgrade pip on what is the solution for it?
>

The solution is to upgrade to Python 3.

https://pip.pypa.io/en/latest/development/release-process/#python-2-support

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


Re: upgrade of pip on my python 2.7 version

2023-09-27 Thread Thomas Passin via Python-list

On 9/27/2023 7:17 AM, Zuri Shaddai Kuchipudi via Python-list wrote:

hello everyone this the error that im getting while trying to install and 
upgrade pip on what is the solution for it?

C:\repository\pst-utils-pc-davinci-simulator>pip install
You are using pip version 7.0.1, however version 23.2.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
You must give at least one requirement to install (see "pip help install")

C:\repository\pst-utils-pc-davinci-simulator>pip install --upgrade pip
You are using pip version 7.0.1, however version 23.2.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting pip
   Using cached 
https://files.pythonhosted.org/packages/ba/19/e63fb4e0d20e48bd2167bb7e857abc0e21679e24805ba921a224df8977c0/pip-23.2.1.tar.gz
 Complete output from command python setup.py egg_info:
 Traceback (most recent call last):
   File "", line 20, in 
   File 
"c:\users\kuchipz\appdata\local\temp\pip-build-gc4ekm\pip\setup.py", line 7
 def read(rel_path: str) -> str:
  ^
 SyntaxError: invalid syntax

 
Command "python setup.py egg_info" failed with error code 1 in 
c:\users\kuchipz\appdata\local\temp\pip-build-gc4ekm\pip


Possibly this:

https://techglimpse.com/install-higher-version-pip-python27/


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


upgrade of pip on my python 2.7 version

2023-09-27 Thread Zuri Shaddai Kuchipudi via Python-list
hello everyone this the error that im getting while trying to install and 
upgrade pip on what is the solution for it?

C:\repository\pst-utils-pc-davinci-simulator>pip install
You are using pip version 7.0.1, however version 23.2.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
You must give at least one requirement to install (see "pip help install")

C:\repository\pst-utils-pc-davinci-simulator>pip install --upgrade pip
You are using pip version 7.0.1, however version 23.2.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting pip
  Using cached 
https://files.pythonhosted.org/packages/ba/19/e63fb4e0d20e48bd2167bb7e857abc0e21679e24805ba921a224df8977c0/pip-23.2.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
  File "", line 20, in 
  File "c:\users\kuchipz\appdata\local\temp\pip-build-gc4ekm\pip\setup.py", 
line 7
def read(rel_path: str) -> str:
 ^
SyntaxError: invalid syntax


Command "python setup.py egg_info" failed with error code 1 in 
c:\users\kuchipz\appdata\local\temp\pip-build-gc4ekm\pip
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 2.7 range Function provokes a Memory Error

2023-03-06 Thread Chris Angelico
On Tue, 7 Mar 2023 at 16:53, Stephen Tucker  wrote:
>
> Hi again,
>
> I tried xrange, but I got an error telling me that my integer was too big
> for a C long.
>
> Clearly, xrange in Py2 is not capable of dealing with Python (that is,
> possibly very long) integers.

That's because Py2 has two different integer types, int and long.

> I am raising this because,
>
> (a) IF xrange in Py3 is a simple "port" from Py2, then it won't handle
> Python integers either.
>
> AND
>
> (b) IF xrange in Py3 is intended to be equivalent to range (which, even in
> Py2, does handle Python integers)
>
> THEN
>
> It could be argued that xrange in Py3 needs some attention from the
> developer(s).


Why don't you actually try Python 3 instead of making assumptions
based on the state of Python from more than a decade ago?

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


Re: Python 2.7 range Function provokes a Memory Error

2023-03-06 Thread Stephen Tucker
Hi again,

I tried xrange, but I got an error telling me that my integer was too big
for a C long.

Clearly, xrange in Py2 is not capable of dealing with Python (that is,
possibly very long) integers.

I am raising this because,

(a) IF xrange in Py3 is a simple "port" from Py2, then it won't handle
Python integers either.

AND

(b) IF xrange in Py3 is intended to be equivalent to range (which, even in
Py2, does handle Python integers)

THEN

It could be argued that xrange in Py3 needs some attention from the
developer(s).

Stephen Tucker.


On Thu, Mar 2, 2023 at 6:24 PM Jon Ribbens via Python-list <
python-list@python.org> wrote:

> On 2023-03-02, Stephen Tucker  wrote:
> > The range function in Python 2.7 (and yes, I know that it is now
> > superseded), provokes a Memory Error when asked to deiliver a very long
> > list of values.
> >
> > I assume that this is because the function produces a list which it then
> > iterates through.
> >
> > 1. Does the  range  function in Python 3.x behave the same way?
>
> No, in Python 3 it is an iterator which produces the next number in the
> sequence each time.
>
> > 2. Is there any equivalent way that behaves more like a  for loop (that
> is,
> > without producing a list)?
>
> Yes, 'xrange' in Python 2 behaves like 'range' in Python 3.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 2.7 range Function provokes a Memory Error

2023-03-02 Thread Jon Ribbens via Python-list
On 2023-03-02, Stephen Tucker  wrote:
> The range function in Python 2.7 (and yes, I know that it is now
> superseded), provokes a Memory Error when asked to deiliver a very long
> list of values.
>
> I assume that this is because the function produces a list which it then
> iterates through.
>
> 1. Does the  range  function in Python 3.x behave the same way?

No, in Python 3 it is an iterator which produces the next number in the
sequence each time.

> 2. Is there any equivalent way that behaves more like a  for loop (that is,
> without producing a list)?

Yes, 'xrange' in Python 2 behaves like 'range' in Python 3.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 2.7 range Function provokes a Memory Error

2023-03-02 Thread Chris Angelico
On Thu, 2 Mar 2023 at 22:27, Stephen Tucker  wrote:
>
> Hi,
>
> The range function in Python 2.7 (and yes, I know that it is now
> superseded), provokes a Memory Error when asked to deiliver a very long
> list of values.
>
> I assume that this is because the function produces a list which it then
> iterates through.
>
> 1. Does the  range  function in Python 3.x behave the same way?

No, but list(range(x)) might, for the same reason. In Py2, range
returns a list, which means it needs a gigantic collection of integer
objects. In Py3, a range object just defines its start/stop/step, but
if you call list() on it, you get the same sort of

> 2. Is there any equivalent way that behaves more like a  for loop (that is,
> without producing a list)?
>
> To get round the problem I have written my own software that is used in a
> for  loop.

xrange is an iterator in Py2, so that's the easiest way to handle it.
Obviously migrating to Py3 would be the best way, but in the meantime,
xrange will probably do what you need.

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


Re: Python 2.7 range Function provokes a Memory Error

2023-03-02 Thread 2QdxY4RzWzUUiLuE
On 2023-03-02 at 11:25:49 +,
Stephen Tucker  wrote:

> The range function in Python 2.7 (and yes, I know that it is now
> superseded), provokes a Memory Error when asked to deiliver a very long
> list of values.
> 
> I assume that this is because the function produces a list which it then
> iterates through.
> 
> 1. Does the  range  function in Python 3.x behave the same way?

No.

> 2. Is there any equivalent way that behaves more like a  for loop (that is,
> without producing a list)?

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


Python 2.7 range Function provokes a Memory Error

2023-03-02 Thread Stephen Tucker
Hi,

The range function in Python 2.7 (and yes, I know that it is now
superseded), provokes a Memory Error when asked to deiliver a very long
list of values.

I assume that this is because the function produces a list which it then
iterates through.

1. Does the  range  function in Python 3.x behave the same way?

2. Is there any equivalent way that behaves more like a  for loop (that is,
without producing a list)?

To get round the problem I have written my own software that is used in a
for  loop.

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


[issue46288] Migrating python 2.7 to 3.6 using 2to3 tool

2022-01-07 Thread Eric V. Smith


Eric V. Smith  added the comment:

Porting questions don't belong on the bug tracker. And we don't support 2.7 any 
more, in any event.

You'll need to find python 3 versions of all of your packages. Unfortunately we 
can't help you with that.

There used to be a python-porting mailing list, but it's been deleted. Maybe 
someone on the the python-list mailing list could point you in the right 
direction.

--
nosy: +eric.smith
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
type: compile error -> behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46288] Migrating python 2.7 to 3.6 using 2to3 tool

2022-01-06 Thread Karthik S


New submission from Karthik S :

Greeting of the day to all..

I would like to address few queries as mentioned in the below.

python 2.7 code is running fine on RHEL 7.9,we are migrating to python3 from 
Python2 using 2to3 on RHEL 7.9. 
After migrating, When we run our products in python 3.6,we are facing some 
modules are not imported error.

Example 1: 
from IN import AF_INET6
ModuleNotFoundError: No module named 'IN'

In 2.7 IN modules coming from python-libs package,but in python3-libs doesnt 
find the IN module.
/usr/lib64/python2.7/plat-linux2/IN.py is avaialbe in 
python-libs-2.7.5-89.el7.x86_64 ,but it is not avilable in python3-libs.

[root@opt]# rpm -ql python-libs | grep -i IN.py
/usr/lib64/python2.7/plat-linux2/IN.py
/usr/lib64/python2.7/plat-linux2/IN.pyc
/usr/lib64/python2.7/plat-linux2/IN.pyo

[root@ opt]# rpm -ql python3-libs | grep -i IN.py
[root@ opt]#

Example2: 

from yum import YumBase
ModuleNotFoundError: No module named 'yum'

In RHEL 7.9 python 2.7 /usr/lib/python2.7/site-packages/yum is avaialbe , but 
in RHEL 7.9 with python3 it is not available.python3 is require python3-dnf but 
this is avaialbe from RHEL 8,doesnt have in RHEL 7.9. 

Kindly help, how to overcome this kind of issue, it would be more helpful for 
us to move forward.

We are using 2to3 migration tool for converting py2 to py3.

--
components: 2to3 (2.x to 3.x conversion tool)
messages: 409950
nosy: mskarthik28
priority: normal
severity: normal
status: open
title: Migrating python 2.7 to 3.6 using 2to3 tool
type: compile error
versions: Python 3.6

___
Python tracker 
<https://bugs.python.org/issue46288>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20513] Python 2.7. Script interruption on logoff from 0 session under Win2003 and earlier

2021-06-18 Thread Irit Katriel


Irit Katriel  added the comment:

The patch doesn't look anything like the current code. Is this issue still 
relevant?

--
nosy: +iritkatriel

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36464] Python 2.7 build install fails intermittently with -j on MacOS

2021-05-16 Thread Carol Willing


Carol Willing  added the comment:

@iritkatriel Thanks for the follow up. I'm going to close this as I haven't 
seen any issues with -j on MacOS.

--
resolution:  -> not a bug
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36464] Python 2.7 build install fails intermittently with -j on MacOS

2021-05-16 Thread Irit Katriel


Irit Katriel  added the comment:

I closed PR 13186 because the change in it was already committed under 
issue36464. Can this issue be closed now as well or is there anything left to 
look into?

--
nosy: +iritkatriel

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39674] Keep deprecated features in Python 3.9 to ease migration from Python 2.7, but remove in Python 3.10

2021-04-08 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 20d56bd41b56023ce9fa3739c0c9aa8be8d48bfa by Markus Gerstel in 
branch '3.8':
bpo-39674: Fix collections ABC deprecation notice (GH-25281)
https://github.com/python/cpython/commit/20d56bd41b56023ce9fa3739c0c9aa8be8d48bfa


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39674] Keep deprecated features in Python 3.9 to ease migration from Python 2.7, but remove in Python 3.10

2021-04-08 Thread Roundup Robot


Change by Roundup Robot :


--
pull_requests: +24017
pull_request: https://github.com/python/cpython/pull/25281

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39674] Keep deprecated features in Python 3.9 to ease migration from Python 2.7, but remove in Python 3.10

2021-04-08 Thread Roundup Robot


Change by Roundup Robot :


--
nosy: +python-dev
nosy_count: 5.0 -> 6.0
pull_requests: +24016
pull_request: https://github.com/python/cpython/pull/25280

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39674] Keep deprecated features in Python 3.9 to ease migration from Python 2.7, but remove in Python 3.10

2021-04-08 Thread ปพนพัชร์ บรรพจันทร์

Change by ปพนพัชร์ บรรพจันทร์ :


--
components: +Unicode -Library (Lib)
nosy: +ezio.melotti
versions: +Python 3.10 -Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43481] PyEval_EvalCode() namespace issue not observed in Python 2.7.

2021-03-24 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Perhaps both.  If you want more discussion, please post to python-list.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43481] PyEval_EvalCode() namespace issue not observed in Python 2.7.

2021-03-24 Thread Chris Morton


Chris Morton  added the comment:

Is this change in behavior considered to be by design or is this issue an 
unintended consequence? It seems inconsistent that comprehensions have no 
visibility of variable previously defined in the same scoping for this 
particular use-case. Is there a way to work around this other than reworking 
the comprehension?

It seems odd that [ci for ci in c] does not produce the error but [c for i in 
[1]] does produce the error.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43481] PyEval_EvalCode() namespace issue not observed in Python 2.7.

2021-03-20 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Foolish me. Commenting out the first exec results in the 2nd exec raising.  
Commenting out the 2nd exec also results in the class code raising, which is 
what I expected.  The point of the class code is to partially explain the 
exception, which is not a bug, but a consequence of passing separate global and 
initial local namespaces, combined with comprehensions being executed, starting 
in 3.0, in a new local namespace, separate from the one you passed in.

The exec doc in https://docs.python.org/3/library/functions.html#exec explains 
the effect of passing different global and local namespaces with "If exec gets 
two separate objects as globals and locals, the code will be executed as if it 
were embedded in a class definition."  There is no class, but this is the only 
way to get the same effect in Python code (without exec/eval).

The NameError has nothing to do with subscripting as it happens upon the 
attempt to load c.  Remove the subscription and the exception it remains.  
Instead, it arises because in 3.x, but not in 2.x, comprehensions are executed 
in a separate local namespace, the same as a method, where the passed in local 
namespace is invisible.

Here are simpler examples that both raise NameError.

exec("c=1\nlist(c for i in [1])", globals(), {})


class A:
c =1
def f(self): c

A().f()

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
type:  -> behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43481] PyEval_EvalCode() namespace issue not observed in Python 2.7.

2021-03-20 Thread Chris Morton


Chris Morton  added the comment:

Hi Terry, The reason why your code does not reproduce the issue is because you 
first execute the code in a global context which then puts the definition of c 
in that context. Subsequent calling in the local context then works. If you 
remove the first exec call (no need for the Class lines either), you will now 
see the issue in 3.8.
This issue is reproducible for other containers such as lists and sets, instead 
of dictionary, in this case. Replacing range(len(c)) with range(4) also shows 
the same error. The error relates to the use of the indexing operator []. The 
same error is observed with other sequences such as:

c={1,2,3,4} 

or

c='1234'

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43481] PyEval_EvalCode() namespace issue not observed in Python 2.7.

2021-03-19 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I cannot reproduce in Python with either 3.8 or 3.10.  (Please try with latter 
if you can.)  I thought the issue might possibly be passing two different 
dicts, which results in the code being executed as if in a class statement, but 
it is not.  

code = '''
c=[1,2,3,4]
d={'list': [c[i] for i in range(len(c))]}
print(d)
'''
bcode = compile(code, '', 'exec')
gdict = globals()
ldict = {}
exec(bcode, gdict, gdict)
exec(bcode, gdict, ldict)
class C:
c=[1,2,3,4]
d={'list': [c[i] for i in range(len(c))]}
print(d)

prints {'list': [1, 2, 3, 4]} 3 times.  Using 'eval' instead of 'exec' gives 
the same.  I presume that code compiled with 'exec' is 'exec'ed even if use 
eval.

--
nosy: +terry.reedy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43481] PyEval_EvalCode() namespace issue not observed in Python 2.7.

2021-03-16 Thread Chris Morton


Chris Morton  added the comment:

Root cause appears to be indexing c with [] operator. Replacing len(c) with 4 
produces the same error.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43481] PyEval_EvalCode() namespace issue not observed in Python 2.7.

2021-03-12 Thread Chris Morton


New submission from Chris Morton :

Compiling (Window 10, MSVS 16):

#include 

int main(int argc, char* argv[])
{
const char* code = "c=[1,2,3,4]\nd={'list': [c[i] for i in 
range(len(c))]}\nprint(d)\n";

Py_Initialize();

PyObject* pycode = Py_CompileString(code, "", Py_file_input );   
PyObject* main_module = PyImport_AddModule("__main__");
PyObject* global_dict = PyModule_GetDict(main_module);
PyObject* local_dict = PyDict_New();

PyEval_EvalCode(pycode, global_dict, local_dict);  // (PyCodeObject*) 
pycode in Python 2.7

Py_Finalize();

return 0;

and executing yields:

Traceback (most recent call last):
  File "", line 2, in 
  File "", line 2, in 
NameError: name 'c' is not defined

While not particularly clever python code, it is not clear why the reference c 
is not in scope having previously been defined. Replacing the clumsy list 
comprehension using range() with c[:] or [ci for ci in c] produces the expected 
result:

{'list': [1, 2, 3, 4]}

This issue is not observed with Python 2.7 (.18).

--
components: C API
messages: 388557
nosy: chrisgmorton
priority: normal
severity: normal
status: open
title: PyEval_EvalCode() namespace issue not observed in Python 2.7.
versions: Python 3.8

___
Python tracker 
<https://bugs.python.org/issue43481>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43044] Python 2.7 documentation links to 404 pages when the library was moved or renamed

2021-03-09 Thread Борис Верховский

Борис Верховский  added the comment:

This was fixed using redirects in nginx 

https://github.com/python/psf-salt/pull/201

--
resolution: out of date -> fixed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Python 2.7 and 3.9

2021-02-18 Thread Pieter van Oostrum
Ethan Furman  writes:

> On 2/16/21 12:09 PM, Kevin M. Wilson via Python-list wrote:
>
>> My employer has hundreds of scripts in 2.7, but I'm writing new
>> scripts in 3.9! I'm running into 'invalid syntax' errors.I have to
>> maintain the 'Legacy' stuff, and I need to mod the path et al., to
>> execute 3.7 w/o doing damage to the 'Legacy' stuff...IDEA' are
>> Welcome!
>
> My first idea/request: have a blank line, a line with only a '--'
> (without quotes), and then your signature at the bottom of your posts. 
> White space aids readability and readability counts.  :)

The separator line should be '-- ' (without quotes), i.e. with a trailing space.
-- 
Pieter van Oostrum
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 2.7 and 3.9

2021-02-17 Thread J. Pic
The best would be to upgrade the scripts, did you try them with 2to3 ? It
should do most of the work, if not all.

https://docs.python.org/3/library/2to3.html
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 2.7 and 3.9

2021-02-17 Thread MRAB

On 2021-02-17 14:09, Thomas Jollans wrote:

On 16/02/2021 22:16, Ethan Furman wrote:
Kevin, please reply to the list (preferably Reply-to-list, or 
Reply-all), that way others can chime in with help.


On 2/16/21 12:55 PM, Kevin M. Wilson wrote:

Windows 7 OS, and typically run in conjunction with testing SSD', as 
for stand alone scripts.
Those require: python BogusFile.py. I too was expecting users to 
type: python my_Script.py!


On Windows, you should use the py.exe launcher:

py -2 python2_script.py

to run an old script, and

py -3 python3_script.py

or

py python3_script.py

to launch a new script. AKAIK, the launcher is always installed with
recent versions of Python on Windows.

The scripts simply need to start with a shebang line that specifies the 
Python version. Then it's just:


py python2_script.py

py python3_script.py



You could set up the PATH such that 'python' is python 2.7, and 'py'
calls python 3.x. Have a look at the docs to figure about what other
options py.exe gives you (such as shebang lines)

Docs:
https://docs.python.org/3/using/windows.html#python-launcher-for-windows

PEP: https://www.python.org/dev/peps/pep-0397


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


Re: Python 2.7 and 3.9

2021-02-17 Thread Thomas Jollans

On 16/02/2021 22:16, Ethan Furman wrote:
Kevin, please reply to the list (preferably Reply-to-list, or 
Reply-all), that way others can chime in with help.


On 2/16/21 12:55 PM, Kevin M. Wilson wrote:

Windows 7 OS, and typically run in conjunction with testing SSD', as 
for stand alone scripts.
Those require: python BogusFile.py. I too was expecting users to 
type: python my_Script.py!


On Windows, you should use the py.exe launcher:

py -2 python2_script.py

to run an old script, and

py -3 python3_script.py

or

py python3_script.py

to launch a new script. AKAIK, the launcher is always installed with 
recent versions of Python on Windows.



You could set up the PATH such that 'python' is python 2.7, and 'py' 
calls python 3.x. Have a look at the docs to figure about what other 
options py.exe gives you (such as shebang lines)


Docs: 
https://docs.python.org/3/using/windows.html#python-launcher-for-windows


PEP: https://www.python.org/dev/peps/pep-0397


-- Thomas



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


Re: Python 2.7 and 3.9

2021-02-16 Thread Richard Damon
On 2/16/21 4:16 PM, Ethan Furman wrote:
> Kevin, please reply to the list (preferably Reply-to-list, or
> Reply-all), that way others can chime in with help.
>
> On 2/16/21 12:55 PM, Kevin M. Wilson wrote:
>
>> Windows 7 OS, and typically run in conjunction with testing SSD', as
>> for stand alone scripts.
>> Those require: python BogusFile.py. I too was expecting users to
>> type: python my_Script.py!
>
> I'm afraid I have no experience with the above, hopefully somebody
> else on the list does.
>
> -- 
> ~Ethan~

It depends a lot on how everything was installed and how the path was
setup. You will at least need the version 2 and version 3 pythons to be
given different names, like python3 and then start the python 3 scripts
with python3 my_script.py

-- 
Richard Damon

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


Re: Python 2.7 and 3.9

2021-02-16 Thread Ethan Furman
Kevin, please reply to the list (preferably Reply-to-list, or 
Reply-all), that way others can chime in with help.


On 2/16/21 12:55 PM, Kevin M. Wilson wrote:

Windows 7 OS, and typically run in conjunction with testing SSD', as for 
stand alone scripts.
Those require: python BogusFile.py. I too was expecting users to type: 
python my_Script.py!


I'm afraid I have no experience with the above, hopefully somebody else 
on the list does.


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


Re: Python 2.7 and 3.9

2021-02-16 Thread Ethan Furman

On 2/16/21 12:09 PM, Kevin M. Wilson via Python-list wrote:


My employer has hundreds of scripts in 2.7, but I'm writing new scripts in 3.9! 
I'm running into 'invalid syntax' errors.I have to maintain the 'Legacy' stuff, 
and I need to mod the path et al., to execute 3.7 w/o doing damage to the 
'Legacy' stuff...IDEA' are Welcome!


My first idea/request: have a blank line, a line with only a '--' 
(without quotes), and then your signature at the bottom of your posts. 
White space aids readability and readability counts.  :)


How are those scripts being run?  Microsoft Windows or Unix/Linux/BSD?

Typically, the first line of a script will say which version of Python 
is needed.  For example, on a *nix type system:


#!/usr/bin/python2

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


Python 2.7 and 3.9

2021-02-16 Thread Kevin M. Wilson via Python-list
My employer has hundreds of scripts in 2.7, but I'm writing new scripts in 3.9! 
I'm running into 'invalid syntax' errors.I have to maintain the 'Legacy' stuff, 
and I need to mod the path et al., to execute 3.7 w/o doing damage to the 
'Legacy' stuff...IDEA' are Welcome!
KMW
John 1:4  "In him was life; and the life was the light of men."
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43044] Python 2.7 documentation links to 404 pages when the library was moved or renamed

2021-01-27 Thread STINNER Victor


STINNER Victor  added the comment:

The Python 2.7 branch has been removed: 
https://github.com/python/cpython/pull/24195#issuecomment-768474389

I close the issue. Please use the Python 3 documentation.

--
nosy: +vstinner
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue43044>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43044] Python 2.7 documentation links to 404 pages when the library was moved or renamed

2021-01-27 Thread Борис Верховский

New submission from Борис Верховский :

1. go to https://docs.python.org/2/library/stringio.html (note the "/2/")
2. click on "You should upgrade and read the Python documentation for the 
current stable release." at the top

I expect to be sent to the Python 3 documentation for StringIO (or at least the 
index.html page of the Python 3 documentaion) but because StringIO was moved 
from its own library into `io`, the Python 2 docs are linking to a 404 error 
page, because they just rewrite "/2/" to "/3/" in the URL.

See attached PR for a list of all these broken pages and where they could 
redirect to.

--
assignee: docs@python
components: Documentation
messages: 385821
nosy: boris, docs@python
priority: normal
pull_requests: 23179
severity: normal
status: open
title: Python 2.7 documentation links to 404 pages when the library was moved 
or renamed
type: enhancement
versions: Python 3.9

___
Python tracker 
<https://bugs.python.org/issue43044>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Installing Python (2.7) 'by hand' on Ubuntu - possible?

2020-12-23 Thread Chris Green
Mirko  wrote:
> On 22.12.2020 at 20:24 Chris Green wrote:
> 
> > Yes, I do have the Python source.  The only thing I don't have the
> > source for is a .so file and that's why I can't simply migrate the
> > program(s) from Python 2 to Python 3.
> > 
> 
> If it's just one .so and that library is compatible with basic libs
> such as glibc and has no further big dependencies, then there may be
> a simpler way than cx_freeze or even snap/docker/etc.
> 
> Python 2 will likely be available for quite some more years as an
> optional package. But even with a self-compiled version, you should
> be able to put the required libraries somewhere and set
> LD_LIBRARY_PATH or maybe LD_PRELOAD accordingly. For a few depending
> libs, this works well, but it gets really nasty if glibc or big
> frameworks such as GTK are involved.

Unfortunately GTK is involved, the utility pops up a GUI that uses
Gtk2, that's part of the can of worms that this has become because of
the non-trivial migration of GTK from Python 2 to Python 3.

As I said I have the Python source and it's not particularly difficult
to move that from Python 2 to Python 3, the killer is a .so compiled
for Python 2.

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


Re: Installing Python (2.7) 'by hand' on Ubuntu - possible?

2020-12-22 Thread Mirko via Python-list
On 22.12.2020 at 20:24 Chris Green wrote:

> Yes, I do have the Python source.  The only thing I don't have the
> source for is a .so file and that's why I can't simply migrate the
> program(s) from Python 2 to Python 3.
> 

If it's just one .so and that library is compatible with basic libs
such as glibc and has no further big dependencies, then there may be
a simpler way than cx_freeze or even snap/docker/etc.

Python 2 will likely be available for quite some more years as an
optional package. But even with a self-compiled version, you should
be able to put the required libraries somewhere and set
LD_LIBRARY_PATH or maybe LD_PRELOAD accordingly. For a few depending
libs, this works well, but it gets really nasty if glibc or big
frameworks such as GTK are involved.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Installing Python (2.7) 'by hand' on Ubuntu - possible?

2020-12-22 Thread Grant Edwards
On 2020-12-22, Chris Green  wrote:
> Grant Edwards  wrote:
>
>> I should have mentioned that bundlers like cx_freeze require that you
>> have the Python source for the main app. I don't remember if you
>> mentioned source or not...
>
> Yes, I do have the Python source.  The only thing I don't have the
> source for is a .so file and that's why I can't simply migrate the
> program(s) from Python 2 to Python 3.

I think cx_freeze should be able to do the job. It tries to
auto-detect what libraries and Python modules are needed, but
sometimes you have manually add one or two to the list.

--
Grant

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


Re: Installing Python (2.7) 'by hand' on Ubuntu - possible?

2020-12-22 Thread Chris Green
Grant Edwards  wrote:
> On 2020-12-22, Chris Green  wrote:
> > Grant Edwards  wrote:
> >> On 2020-12-22, Chris Green  wrote:
> >> > [...]
> >> >
> >> > How realistic/possible would it be to run the utility in a separate
> >> > environment with its own copies of Python2 and any modules and
> >> > libraries needed?  I would install these 'by hand', i.e. not using
> >> > 'apt' so they would stay as installed even as my system gets upgraded.
> >> 
> >> If you do have it running on a Linux system, then there are tools to
> >> "bundle" it with all the required libraries. The one that I've used
> >> most recently is cx_freeze (I generally use it to create bundles for
> >> Windows):
> >> 
> >> https://cx-freeze.readthedocs.io/en/latest/index.html
> >> 
> >> If you want to use it for a 2.7 app, you'd need to use 5.1
> >
> > That looks a good approach, thank you.
> 
> I should have mentioned that bundlers like cx_freeze require that you
> have the Python source for the main app. I don't remember if you
> mentioned source or not...
> 
Yes, I do have the Python source.  The only thing I don't have the
source for is a .so file and that's why I can't simply migrate the
program(s) from Python 2 to Python 3.

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


Re: Installing Python (2.7) 'by hand' on Ubuntu - possible?

2020-12-22 Thread Grant Edwards
On 2020-12-22, Chris Green  wrote:
> Grant Edwards  wrote:
>> On 2020-12-22, Chris Green  wrote:
>> > [...]
>> >
>> > How realistic/possible would it be to run the utility in a separate
>> > environment with its own copies of Python2 and any modules and
>> > libraries needed?  I would install these 'by hand', i.e. not using
>> > 'apt' so they would stay as installed even as my system gets upgraded.
>> 
>> If you do have it running on a Linux system, then there are tools to
>> "bundle" it with all the required libraries. The one that I've used
>> most recently is cx_freeze (I generally use it to create bundles for
>> Windows):
>> 
>> https://cx-freeze.readthedocs.io/en/latest/index.html
>> 
>> If you want to use it for a 2.7 app, you'd need to use 5.1
>
> That looks a good approach, thank you.

I should have mentioned that bundlers like cx_freeze require that you
have the Python source for the main app. I don't remember if you
mentioned source or not...

--
Grant



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


Re: Installing Python (2.7) 'by hand' on Ubuntu - possible?

2020-12-22 Thread Chris Green
Grant Edwards  wrote:
> On 2020-12-22, Chris Green  wrote:
> > [...]
> >
> > How realistic/possible would it be to run the utility in a separate
> > environment with its own copies of Python2 and any modules and
> > libraries needed?  I would install these 'by hand', i.e. not using
> > 'apt' so they would stay as installed even as my system gets upgraded.
> 
> If you do have it running on a Linux system, then there are tools to
> "bundle" it with all the required libraries. The one that I've used
> most recently is cx_freeze (I generally use it to create bundles for
> Windows):
> 
> https://cx-freeze.readthedocs.io/en/latest/index.html
> 
> If you want to use it for a 2.7 app, you'd need to use 5.1
> 
That looks a good approach, thank you.

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


Re: Installing Python (2.7) 'by hand' on Ubuntu - possible?

2020-12-22 Thread Chris Angelico
On Wed, Dec 23, 2020 at 2:21 AM Chris Green  wrote:
>
> I have (as discussed here) a printer utility that uses Python 2 and I
> can't update it to Python 3 because it has a .so library file which is
> compiled for Python 2.  I think I have exhausted all the possibilities
> for converting it to Python 3 so now I'm looking at how to keep it
> working on my [x]ubuntu Linux systems as Python 2.7 becomes unsupported.
>
> How realistic/possible would it be to run the utility in a separate
> environment with its own copies of Python2 and any modules and
> libraries needed?  I would install these 'by hand', i.e. not using
> 'apt' so they would stay as installed even as my system gets upgraded.
>

It shouldn't be too hard to grab the source code for Python 2.7 and
install it that way. The first step would be to ask apt to install all
the build dependencies of Python 3; the same libraries will be
important for building Python 2 (bar a couple that got added more
recently, but that won't affect anything).

Once you get it built, you can either just install it as is, or build
yourself a package (with checkinstall or something) to be able to
uninstall later. Personally, I'd just install it directly, but that's
me.

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


Re: Installing Python (2.7) 'by hand' on Ubuntu - possible?

2020-12-22 Thread Grant Edwards
On 2020-12-22, Chris Green  wrote:
> [...]
>
> How realistic/possible would it be to run the utility in a separate
> environment with its own copies of Python2 and any modules and
> libraries needed?  I would install these 'by hand', i.e. not using
> 'apt' so they would stay as installed even as my system gets upgraded.

If you do have it running on a Linux system, then there are tools to
"bundle" it with all the required libraries. The one that I've used
most recently is cx_freeze (I generally use it to create bundles for
Windows):

https://cx-freeze.readthedocs.io/en/latest/index.html

If you want to use it for a 2.7 app, you'd need to use 5.1

--
Grant


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


Re: Installing Python (2.7) 'by hand' on Ubuntu - possible?

2020-12-22 Thread Michael Torrie
On 12/22/20 9:44 AM, Chris Green wrote:
> I have it running on 20.04 (with a couple of compatibility packages
> from a PPA) but I know I start hitting problems as soon as I move to
> 20.10.  So that does sound like an excellent idea.  Where can I find
> information about building container type things like snap?

Good question.  A quick search reveals this potential starting place:
https://ubuntu.com/tutorials/create-your-first-snap

Also
https://snapcraft.io/docs/python-plugin
https://snapcraft.io/docs/python-apps

That's all I know. Sorry I suggested a solution I know nothing about!


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


Re: Installing Python (2.7) 'by hand' on Ubuntu - possible?

2020-12-22 Thread Chris Green
Michael Torrie  wrote:
> On 12/22/20 8:10 AM, Chris Green wrote:
> > I have (as discussed here) a printer utility that uses Python 2 and I
> > can't update it to Python 3 because it has a .so library file which is
> > compiled for Python 2.  I think I have exhausted all the possibilities
> > for converting it to Python 3 so now I'm looking at how to keep it
> > working on my [x]ubuntu Linux systems as Python 2.7 becomes unsupported.
> > 
> > How realistic/possible would it be to run the utility in a separate
> > environment with its own copies of Python2 and any modules and
> > libraries needed?  I would install these 'by hand', i.e. not using
> > 'apt' so they would stay as installed even as my system gets upgraded. 
> > 
> > There would obviously be *some* dependencies on the system libraries
> > but I think they'd be pretty low level and thus their interfaces would
> > be very unlikely to change for a long time so I should be able to run
> > my old Python2.7 and the Python modules needed for the utility for
> > quite a few years anyway (the printer it supports will wear out
> > eventually!).
> 
> Probably your best bet is to build a container image (perhaps a snap)
> around with a distro that has Python 2.7 in it to house your app. That
> way you've got everything you need including the required system
> libraries.  Right now you could build a image of it based on Ubuntu
> 20.04 which has python 2.7 as an optional installable package.
> 
I have it running on 20.04 (with a couple of compatibility packages
from a PPA) but I know I start hitting problems as soon as I move to
20.10.  So that does sound like an excellent idea.  Where can I find
information about building container type things like snap?

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


Re: Installing Python (2.7) 'by hand' on Ubuntu - possible?

2020-12-22 Thread Grant Edwards
On 2020-12-22, Chris Green  wrote:
> I have (as discussed here) a printer utility that uses Python 2 and I
> can't update it to Python 3 because it has a .so library file which is
> compiled for Python 2.  I think I have exhausted all the possibilities
> for converting it to Python 3 so now I'm looking at how to keep it
> working on my [x]ubuntu Linux systems as Python 2.7 becomes unsupported.
>
> How realistic/possible would it be to run the utility in a separate
> environment with its own copies of Python2 and any modules and
> libraries needed?

That depends on the modules and libraries needed. If it's just
python2, it should be pretty easy. If it needs things like GTK or Qt,
it gets a _lot_ harder.

-- 
Grant

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


Re: Installing Python (2.7) 'by hand' on Ubuntu - possible?

2020-12-22 Thread Michael Torrie
On 12/22/20 8:10 AM, Chris Green wrote:
> I have (as discussed here) a printer utility that uses Python 2 and I
> can't update it to Python 3 because it has a .so library file which is
> compiled for Python 2.  I think I have exhausted all the possibilities
> for converting it to Python 3 so now I'm looking at how to keep it
> working on my [x]ubuntu Linux systems as Python 2.7 becomes unsupported.
> 
> How realistic/possible would it be to run the utility in a separate
> environment with its own copies of Python2 and any modules and
> libraries needed?  I would install these 'by hand', i.e. not using
> 'apt' so they would stay as installed even as my system gets upgraded. 
> 
> There would obviously be *some* dependencies on the system libraries
> but I think they'd be pretty low level and thus their interfaces would
> be very unlikely to change for a long time so I should be able to run
> my old Python2.7 and the Python modules needed for the utility for
> quite a few years anyway (the printer it supports will wear out
> eventually!).

Probably your best bet is to build a container image (perhaps a snap)
around with a distro that has Python 2.7 in it to house your app. That
way you've got everything you need including the required system
libraries.  Right now you could build a image of it based on Ubuntu
20.04 which has python 2.7 as an optional installable package.

Sure you could build Python 2.7 for as long as the compatible compilers
and other dependent libraries are available.  I expect RHEL to keep
building python 2.7 for another 10 years.  Ubuntu 20.04 will continue to
ship python 2.7 as an optional package for another 5 years at least.

There are ways even besides containers that work. With some scripts to
set up custom library paths and trees of custom libraries, you can run
old binary software on newer distros even. With some help from the
interwebs, I am able to run WordPerfect 8 for Linux on my Fedora 32 box.
 That was released back in the kernel 2.0 days, before the transition to
glibc.
-- 
https://mail.python.org/mailman/listinfo/python-list


Installing Python (2.7) 'by hand' on Ubuntu - possible?

2020-12-22 Thread Chris Green
I have (as discussed here) a printer utility that uses Python 2 and I
can't update it to Python 3 because it has a .so library file which is
compiled for Python 2.  I think I have exhausted all the possibilities
for converting it to Python 3 so now I'm looking at how to keep it
working on my [x]ubuntu Linux systems as Python 2.7 becomes unsupported.

How realistic/possible would it be to run the utility in a separate
environment with its own copies of Python2 and any modules and
libraries needed?  I would install these 'by hand', i.e. not using
'apt' so they would stay as installed even as my system gets upgraded. 

There would obviously be *some* dependencies on the system libraries
but I think they'd be pretty low level and thus their interfaces would
be very unlikely to change for a long time so I should be able to run
my old Python2.7 and the Python modules needed for the utility for
quite a few years anyway (the printer it supports will wear out
eventually!).

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


Re: How to write differently to remove this type hint in Python 2.7?

2020-10-21 Thread Mats Wichmann
On 10/21/20 3:24 PM, Shaozhong SHI wrote:
> Is there another way to do this?
> 
> def greet(name: str) -> str:
> return "Hello, " + name
> greet
> 
> File "", line 1 def greet(name: str) -> str:
> ^ SyntaxError: invalid syntax
> 

The hinting pep PEP (484) has an alternate syntax that doesn't break 2.7.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to write differently to remove this type hint in Python 2.7?

2020-10-21 Thread Chris Angelico
On Thu, Oct 22, 2020 at 8:26 AM Shaozhong SHI  wrote:
>
> Is there another way to do this?
>
> def greet(name: str) -> str:
> return "Hello, " + name
> greet
>
> File "", line 1 def greet(name: str) -> str:
> ^ SyntaxError: invalid syntax

If you need to support Python 2, don't use annotations. It's that simple. :)

Bear in mind that Python 2 is now extremely old, and is no longer
supported. A much better option is to use a newer interpreter.

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


How to write differently to remove this type hint in Python 2.7?

2020-10-21 Thread Shaozhong SHI
Is there another way to do this?

def greet(name: str) -> str:
return "Hello, " + name
greet

File "", line 1 def greet(name: str) -> str:
^ SyntaxError: invalid syntax
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue19521] Parallel build race condition on AIX since python-2.7

2020-09-10 Thread Stefan Krah


Stefan Krah  added the comment:

I have been asked to backport this to 3.8. There's a very small window
of opportunity:

3.8.6: Monday, 2020-09-21
3.8.7rc1: Monday, 2020-11-02
3.8.7: Monday, 2020-11-16 (final version!)


Backporting procedures since 3.8 are unclear and a source of
constant friction, so most core developers seem to have stopped
doing any backports at all.  It is not a battle I'll choose, but
if you get a second core dev to review this trivial patch I'll
commit it.

There's a simple solution for 3.8: Do not use the parallel build,
the regular build takes around 4 min.


For the buildbots you can ask the operator for a custom command
line.

--
status: closed -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19521] Parallel build race condition on AIX since python-2.7

2020-08-29 Thread Stefan Krah


Stefan Krah  added the comment:

This is in master and 3.9.1.  I'll not backport to 3.8 because a release 
candidate is imminent.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
type:  -> behavior
versions: +Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19521] Parallel build race condition on AIX since python-2.7

2020-08-29 Thread Stefan Krah


Stefan Krah  added the comment:


New changeset 88b86a9752afc2c50ca196f6ba1a8d62d71cf398 by Miss Islington (bot) 
in branch '3.9':
bpo-19521: Fix parallel build race condition on AIX (GH-22001)
https://github.com/python/cpython/commit/88b86a9752afc2c50ca196f6ba1a8d62d71cf398


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19521] Parallel build race condition on AIX since python-2.7

2020-08-29 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 8.0 -> 9.0
pull_requests: +21107
pull_request: https://github.com/python/cpython/pull/22001

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19521] Parallel build race condition on AIX since python-2.7

2020-08-29 Thread miss-islington


Change by miss-islington :


--
pull_requests: +21108
pull_request: https://github.com/python/cpython/pull/22002

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19521] Parallel build race condition on AIX since python-2.7

2020-08-29 Thread Stefan Krah


Stefan Krah  added the comment:


New changeset e6dcd371b2c54a94584dd124e8c592a496d46a47 by Stefan Krah in branch 
'master':
bpo-19521: Fix parallel build race condition on AIX (GH-21997)
https://github.com/python/cpython/commit/e6dcd371b2c54a94584dd124e8c592a496d46a47


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19521] Parallel build race condition on AIX since python-2.7

2020-08-29 Thread Stefan Krah


Stefan Krah  added the comment:

I can't find the reason for:

if test -z "$EXPORTSYMS"; then
EXPORTSYMS="Modules/python.exp"
fi


Modules/python.exp is hardcoded elsewhere, and I'd rather set
EXPORTSYMS unconditionally on AIX and unset it unconditionally
for all other systems (which don't build with the patch if
EXPORTSYMS happens to be defined).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19521] Parallel build race condition on AIX since python-2.7

2020-08-29 Thread Stefan Krah


Stefan Krah  added the comment:

Okay, thanks.  The -G option is of course attractive for Linux projects
because it requires minimal changes in the build machinery.

I've added support for libmpdec/libmpdec++ (next release) for AIX-style
shared libraries (shr.o inside libmpdec.a).  The AIX linker has a certain
elegance, but it requires something like 150 lines of code changes and
conditionals inside the Makefiles.

I can confirm that -G is substantially slower, so I'm going to commit this
patch soon.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19521] Parallel build race condition on AIX since python-2.7

2020-08-29 Thread Stefan Krah


Change by Stefan Krah :


--
pull_requests: +21103
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21997

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19521] Parallel build race condition on AIX since python-2.7

2020-08-18 Thread David Edelsohn


David Edelsohn  added the comment:

Yes, export file generation still is required.

Python does not need to utilize runtime linking.  Using -G is a very bad choice 
and severely discouraged with severe performance and other penalties.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19521] Parallel build race condition on AIX since python-2.7

2020-08-18 Thread Stefan Krah


Stefan Krah  added the comment:

The original patch is a bit dated, do we still need the export symbol 
generation?

https://www.ibm.com/support/knowledgecenter/en/SSGH3R_16.1.0/com.ibm.xlcpp161.aix.doc/proguide/compiling_shared_aix.html

"Use the -G option to create a shared library from the generated object files, 
and to enable runtime linking with applications that support it."

"If you do not specify a -bE option, all the global symbols are exported except 
for those symbols that have the hidden or internal visibility attribute."

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19521] Parallel build race condition on AIX since python-2.7

2020-08-15 Thread Stefan Krah


Change by Stefan Krah :


--
nosy: +BTaskaya, Michael.Felt, kadler, skrah

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19521] Parallel build race condition on AIX since python-2.7

2020-08-15 Thread Stefan Krah


Change by Stefan Krah :


--
versions: +Python 3.10 -Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 
3.5, Python 3.6, Python 3.7

___
Python tracker 
<https://bugs.python.org/issue19521>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41238] Python 3 shelve.DbfilenameShelf is generating 164 times larger files than Python 2.7 when storing dicts

2020-08-06 Thread Jeffrey Kintscher


Change by Jeffrey Kintscher :


--
nosy: +Jeffrey.Kintscher

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41238] Python 3 shelve.DbfilenameShelf is generating 164 times larger files than Python 2.7 when storing dicts

2020-07-08 Thread Paweł Miech

Paweł Miech  added the comment:

Ok so I see this is an issue that involves the way Pickle pickles Python set 
objects. Updated script to reproduce appended. Apparently, sets are becoming 
much larger when stored in Python3 pickle.

--
Added file: https://bugs.python.org/file49308/test_anydbm.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41238] Python 3 shelve.DbfilenameShelf is generating 164 times larger files than Python 2.7 when storing dicts

2020-07-08 Thread Paweł Miech

New submission from Paweł Miech :

I'm porting some code from Python 2.7 to Python 3.8. There is some code that is 
using shelve.DbfilenameShelf to store some nested dictionaries with sets. I 
found out that compared with Python 2.7 Python 3.8 shelve generates files that 
are approximately 164 larger on disk. Python 3.8 file is 2 027 520 size, when 
Python 2.7 size is 12 288.

Code sample:
Filename: test_anydbm.py

#!/usr/bin/env python
import datetime
import shelve
import sys
import time
from os import path


def main():
print(sys.version)
fname = 'shelf_test_{}'.format(datetime.datetime.now().isoformat())
bucket = shelve.DbfilenameShelf(fname, "n")
now = time.time()
limit = 1000
key = 'some key > some key > other'
top_dict = {}
to_store = {
1: {
'page_item_numbers': set(),
'products_on_page': None
}
}
for i in range(limit):
to_store[1]['page_item_numbers'].add(i)
top_dict[key] = to_store
bucket[key] = top_dict
end = time.time()
db_file = False
try:
fsize = path.getsize(fname)
except Exception as e:
print("file not found? {}".format(e))
try:
fsize = path.getsize(fname + '.db')
db_file = True
except Exception as e:
print("file not found? {}".format(e))
fsize = None
print("Stored {} in {} filesize {}".format(limit, end - now, fsize))
print(fname)
bucket.close()
bucket = shelve.DbfilenameShelf(fname, flag="r")
if db_file:
fname += '.db'
print("In file {} {}".format(fname, len(list(bucket.items()

Output of running it in docker image:

Dockerfile:
FROM python:2-jessie
VOLUME /scripts
CMD scripts/test_anydbm.py

2.7.16 (default, Jul 10 2019, 03:39:20) 
[GCC 4.9.2]
Stored 1000 in 0.0814290046692 filesize 12288
shelf_test_2020-07-08T07:26:23.778769
In file shelf_test_2020-07-08T07:26:23.778769 1


So you can see file size: 12 288

And now running same thing in Python 3

Dockerfile:

FROM python:3.8-slim-buster
VOLUME /scripts
CMD scripts/test_anydbm.py

3.8.3 (default, Jun  9 2020, 17:49:41) 
[GCC 8.3.0]
Stored 1000 in 0.02681446075439453 filesize 2027520
shelf_test_2020-07-08T07:27:18.068638
In file shelf_test_2020-07-08T07:27:18.068638 1

Notice file size: 2 027 520

Why is this happening? Is this a bug? If I'd like to fix it, do you have some 
ideas about causes of this?

--
components: Library (Lib)
files: test_anydbm.py
messages: 373284
nosy: Paweł Miech
priority: normal
severity: normal
status: open
title: Python 3 shelve.DbfilenameShelf is generating 164 times larger files 
than Python 2.7 when storing dicts
type: resource usage
versions: Python 3.8
Added file: https://bugs.python.org/file49304/test_anydbm.py

___
Python tracker 
<https://bugs.python.org/issue41238>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36464] Python 2.7 build install fails intermittently with -j on MacOS

2020-05-31 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

Even though this mentions Python 2, the pull request is against master.

--
nosy: +cheryl.sabella

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36464] Python 2.7 build install fails intermittently with -j on MacOS

2020-05-31 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
versions: +Python 3.10 -Python 2.7

___
Python tracker 
<https://bugs.python.org/issue36464>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29796] [2.7] test_weakref hangs on Python 2.7 on Windows

2020-04-27 Thread STINNER Victor


STINNER Victor  added the comment:

Yep, I didn't see any test_weakref hang anymore since this commit.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   3   4   5   6   7   8   9   10   >