Al usar pathlib, aparece el error: Error de tipo: archivo no válido: PosixPath ('ejemplo.txt')
Estoy usando Python 3pathlib
módulo, así:
from pathlib import Path
filename = Path(__file__).parent / "example.txt"
contents = open(filename, "r").read()
Pero recibo este error en algunas máquinas:
TypeError: invalid file: PosixPath('example.txt')
Pero en mi máquina funciona.