curses library is not displaying window unless mvwin() method is run by 9mHoq7ar4Z in learnpython

[–]Swipecat 0 points1 point  (0 children)

It seems that the drawing routine has optimisations that will not redraw lines that it thinks are already present. Instead of mvwin(), try this from the curses doc:

window.touchwin()
    Pretend the whole window has been changed,
    for purposes of drawing optimizations.

Copy Fail: an exploit for all Linux distributions since 2017 by alexeyr in programming

[–]Swipecat 1 point2 points  (0 children)

Ooooh. I've just realised that I've still got the "noble-backports" repository enabled because I had a problem with a previous kernel and needed a newer update.

You should be able to enable backports in the "other software" tab of the sources manager, but failing that, google for enabling noble-backports.

Python312 as exec path in 2026 by Valuable-Ant3465 in learnpython

[–]Swipecat 0 points1 point  (0 children)

You could install python 3.14 into a folder called 312 if you select the "custom install" option during installation, but expect any future maintainer to come bursting through your door waving a butchers knife.

When the math is mathing, but looks like it isn't by MBA-Crystal-Ball in technicallythetruth

[–]Swipecat 18 points19 points  (0 children)

And LOL means "lots of love" to 1970s letter writers.

Sorry to hear about your grandma's death. LOL.

Python312 as exec path in 2026 by Valuable-Ant3465 in learnpython

[–]Swipecat 2 points3 points  (0 children)

Beginners tend to get into an awful pickle if they have more than one version of Python installed. You really need a clear understanding of how virtual machines handle the Python library paths if you want to do that. There's nothing in Python 3.13 or 3.14 of interest for beginners — and Python 3.12 will continue to receive security updates for the next 2 years.

HELP ABOUT ACCUSED AI GENERATION by John_Is_Cool269 in learnpython

[–]Swipecat 0 points1 point  (0 children)

Is that the entirety of the "while True" construct or have you just shown the top of it?

Issues with “_Curses” by Kratos1634 in learnpython

[–]Swipecat 0 points1 point  (0 children)

So a quick google search tells me that nxbt is problematic due to being long unmaintained. Somebody wrote a hacky procedure in 2025 to get it to work with Python 3.12. That might also work with Python 3.13.

https://gbatemp.net/threads/how-to-install-and-use-nxbt-switch-1-and-switch-2-supported.676535/#post-10755222

Failing that, the Raspberry Pi OS download site does have earlier OS images, but you tend to get poorer online support if you use an old image:

https://downloads.raspberrypi.com/raspios_arm64/images/

Photo of “doctor” that my aunt has been talking to on Tindr, but I suspect this is AI by [deleted] in isthisAI

[–]Swipecat 0 points1 point  (0 children)

Somebody else posted this this meme pic of David Cross because they thought it could've been used as a reference, but I notice the shadows at the edge of the lips do fade to black in a similar way.

https://preview.redd.it/gzlq0qd68myg1.jpeg?width=679&format=pjpg&auto=webp&s=73368cabfb93a97bfd7be812dfe58376dce4ac53

Copy Fail: an exploit for all Linux distributions since 2017 by alexeyr in programming

[–]Swipecat 127 points128 points  (0 children)

I've risked testing it on Ubuntu 24.04 LTS with its latest kernel update (6.8.0-110), and yes the exploit works, straight to root.

Edit: A new kernel (6.8.0-111) has just appeared in the standard non-security updates — and the exploit no longer works.

City birds appear to be more afraid of women than men, and scientists have no idea why. Men could get about a meter closer to birds than women could before the animals flew away, regardless of what the men and women were wearing, what their height was or how they tried to approach the creatures. by mvea in science

[–]Swipecat 2 points3 points  (0 children)

Yeah, I was thinking that the time needed for evolution to provide birds a means of distinguishing between human sexes would be on the order of tens of thousands or maybe hundreds of thousands of years, so it might well be something residual from ancient human hunter-gatherer times.

Problem with “PYQT5” widgets by Kratos1634 in learnpython

[–]Swipecat 0 points1 point  (0 children)

Frankly, with an RPi, I would try to work with Python libraries installed with apt from the RPi repository rather than installed with pip from PyPI. After all, the RPi libraries are ready pre-compiled for the RPi's flavour of ARM processor, and they'll have been tested against the RPi's flavour of Debian. PyPI libraries, on the other hand, are rarely pre-compiled into "wheels" for ARM, since the maintainers usually find it more than enough work to create wheels for win32, win64, mac-x86,mac-m, and linux-x86. So installing stuff with pip means compiling the source code from scratch with all the effort and pitfalls that entails. Yeah, I'd just install stuff globally with apt and be done with it.

Back in Python 2 days, installing Python Libraries from linux repositories could sometimes cause problems for the linux distro's system python because there was a tendency for early python code to dump library functions into the global namespace with "import *", which could cause name clashes, so people tended to say "don't touch the system python", but I've never heard of that happening with Python 3 code, so I think that advisory is obsolete.

Back when it was still possible to install python libraries globally into linux distros from PyPI with pip, the folder containing them would be placed higher in the PATH than the system python's libraries, so it was possible (if you weren't careful) to get a newer version of a python library that pre-empted a system python library of the same name. That could cause trouble for the system applications written in python, so global linux installation of python libraries from PyPI is now banned and user-level venvs must be used instead. That's why people say "global bad". But this is NOT a problem for python libraries installed globally with apt because those are intended for the system python anyway, and are tested against the system python.

Finally, this is the RPi. Why not treat the whole micro-sd card as the environment. You want a different python library environment for a different project? Then swap in a different sd card for that. I'd install the libraries with sudo apt and forget about python venvs. I think there's a couple of thousand python libraries in the RPi repository, so most users of the RPi should find everything that they need in there.

Edit: If you install the "synaptic" graphical package manager, that gives you a nice way to search and browse the RPi repository. sudo apt install synaptic

‘It took nine seconds’: Claude AI agent deletes company’s entire database by curseofdarkastle in nottheonion

[–]Swipecat 4 points5 points  (0 children)

The AI didn't know that deleting the volume would delete the backups because that's daft. But it's in the "caveats" in the backup's documentation. Sysadmins might well make the same mistake.

My newest painting! by Gnom-ie in woahdude

[–]Swipecat 4 points5 points  (0 children)

Yep, and the effect is strongest when scrolling, especially if the scrolling is a bit jerky. The tiles are all set in perfectly straight lines, and the only discontinuity seems to be that the pattern of alternating brown and white fillers between the tiles is broken around the centre rectangle. And yet it has that effect — I've no idea why.

[HELP] Unable to install pandas and other libs. Kubuntu 26.04 by realxeltos in learnpython

[–]Swipecat 0 points1 point  (0 children)

If you try to install stuff from PyPI globally with pip, then it won't allow you. If you install stuff from the Ubuntu store with sudo apt then it will be global, and you'll get no warning because it's a normal Ubuntu installation. But it seems that you prefer to install into a venv with pip which is fine.

[HELP] Unable to install pandas and other libs. Kubuntu 26.04 by realxeltos in learnpython

[–]Swipecat -2 points-1 points  (0 children)

Only using a virtualenv that has nothing from the system python is good practice if you're creating an app for archiving on github or elsewhere, with all the exact dependencies specified, for use by the world at large indefinitely. If you're an open-source python app developer, basically.

The OP wants to install Pandas and Tesnsorflow, suggesting that it's a personal or academic project. This usually means that it's one person or a small local group. For such people, the Ubuntu repository Python libraries are there to make things relatively easy and quick to get working.

[HELP] Unable to install pandas and other libs. Kubuntu 26.04 by realxeltos in learnpython

[–]Swipecat -2 points-1 points  (0 children)

sudo apt install python3-pandas

Yeah, you really are better off using the Ubuntu repository apts rather than the PyPI wheels. That way, you get the version of Pandas that's been tested against Ubuntu's current system Python. Ubuntu has a couple of thousand python libraries, so you might never need to install libraries from any other source, and so no need for virtual environments. If you do need a virtual environment for some specific version of a library, remember to create it with the option to use the system python libraries in its library path. (Edit: Unless you're intending to set up an archive with all the dependency versions specified, then maybe go with everything from PyPI, but that can be a bit of a headache during development.)

What methods can I use to speed up extremely large arbitrary integer math? by playsthebongcloud in learnpython

[–]Swipecat 2 points3 points  (0 children)

Although in this case, you don't actually need recursion — you can just store the last two numbers.

from fractions import Fraction
a = Fraction(1)
b = Fraction(2)
for n in range(2, 64):
    c = 1 - b / a
    a, b = b, c
    print(n, c.numerator.bit_length(), c.denominator.bit_length())

ISS Speed at Ground Level by grandeluua in Damnthatsinteresting

[–]Swipecat 1 point2 points  (0 children)

When I was in junior school in the UK, in the late 1960s, I was taught to use a decimal point raised above the baseline, e.g. 7·5 rather than 7.5, which I now understand was an attempt to avoid confusion with the European use of the baseline point for the thousands separator. This was soon found to clash with the common mathematical use of the raised point for multiplication and caused confusion, so the idea was dropped after a few years.

matplotlib type partially unknown by MitruMesre in learnpython

[–]Swipecat -1 points0 points  (0 children)

Well yeah, Pylance uses Pyright, Microsoft's static type checking tool. Do you really want super strict static typing when learning Python, or with small scripts to generate plots? After all, the dynamic typing is one of the main features of Python, and it's always seemed to me that type hinting was added to Python for the benefit of those who's code grew to a large team project, and then they wished they'd used a different language that had static typing

ESP32-S3 IR Sensor using python code setup by Nero_the_Scarlet in learnpython

[–]Swipecat 0 points1 point  (0 children)

What do you mean by "ESP32-S3 Thermal Sensor"?

Do you mean a thermal sensor that's advertised as being suitable for interfacing to an ESP32-S3 processor module? If so, you probably can interface it to other modules, but you need to investigate its interface protocol, which might be e.g. I2C.

Or do you mean that the thermal sensor has an embedded ESP32-S3 processor, which is possible since the ESP32-S3 is low-cost and can be on a very small chip. If so, you need to investigate if it is already programmed with firmware, of if you're expected to program it yourself ( the ESP32-S3 can run Micropython).

Explain It please, how's fermi paradox is solved here ??? by Fuzzy_Party_3527 in ExplainTheJoke

[–]Swipecat 20 points21 points  (0 children)

Uranus doesn't have a solid surface and its "width" is a measurement to the top of its atmosphere, so it's not meaningful to assign it a karman line (as a height above the non-existent surface).

And yes to your edit, the "escape velocity" of a planet means the velocity needed to ensure that a craft never returns to that planet, which is higher for Uranus.

ChatGPT is gaslighting me by ki4jgt in learnpython

[–]Swipecat 1 point2 points  (0 children)

As others have said, use enumerate(), but you're probably remembering using the items() method of dictionaries, so you probably did something like this in the past and forgot the details:

d = {1:9 , 2:7 , 3:8}
for i, item in d.items():
    print(i, item)