Now this is an interesting #Python problem. I don't know if it's a #bug, but it's a change in behaviour that I don't see documented.
I upgraded from #Debian 12/Bookworm to 13/Trixie, so the default Python3 changed from 3.11 to 3.13. A script of mine broke, because `pathlib.Path.is_mount()` […]
💡 Tip #83 en #Python
¡Manipula Rutas de Archivos como un Pro con pathlib 📂✨
¿Sigues usando os.path.join, os.path.dirname, o manual slicing para manejar las rutas de tus archivos?
www.linkedin.com/feed/update/...
#JoseCodeTech #Programacion #AprendePython #PythonTips #Pathlib #CleanCode #Pythonic
Pathlib in Python: Modern, Secure File Path Handling When building Python applications, working with files and directories is unavoidable. Traditionally, developers relied on plain strings to repre...
#python #path-traversal #python-security #pathlib #secure-coding
Origin | Interest | Match
The wonders of #Python on #Windows (via #MSYS2)...
If you run you Python script using "./script.py", then `Path` from #pathlib becomes `PosixPath`.
If you run the same script using "python script.py" instead, then `Path` becomes `WindowsPath`.
Chers!
In Python, instead of this:
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
I prefer this:
BASE_DIR = pathlib.Path(__file__).resolve().parent.parent
For more on the magic of #Python's #pathlib, check out the article I published last week:
This is really nice. I've been making the effort to use #pathlib everywhere so I build the habit. Will be sharing this article with my team as useful learning!