Sujet : Liens symboliques sous Windows De : ast (at) *nospam* invalid (ast) Groupes :fr.comp.lang.python Date : 17. Nov 2021, 09:40:33 Autres entêtes Organisation : Guest of ProXad - France Message-ID :<6194c003$0$20251$426a74cc@news.free.fr> User-Agent : Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Thunderbird/91.3.1
Bonjour Il me semble que les liens symboliques de Windows ne sont pas bien reconnus par les modules os et pathlib. Voyez: >>> from pathlib import Path >>> p2 = Path('C:/Users/jm/desktop/json.txt - Raccourci.lnk') >>> p2 WindowsPath('C:/Users/jm/desktop/json.txt - Raccourci.lnk') >>> p2.exists() True >>> p2.is_file() True >>> p2.is_symlink() False Sur cette dernière commande, j'attendais True et pour le p2.is_file j'attendais plutôt False Avec la lib os, c'est pareil import os >>> os.path.exists(p2) True >>> os.path.isfile(p2) True os.path.islink(p2) False