0
Good afternoon, I am using the textract library to extract contents inside a folder and for that I am using a function that inserts the beginning of the directory('./book') and the extension of the file('.pdf') the problem and that even if the file exists it says it does not find the file, this code is part of a larger project and it was when I added this part that stopped working, I believe it is a problem of strings but I do not know identify the problem
import textract
def imprimir(nome):
inicio="./livro/"
fim=".pdf"
ficheiro = inicio+nome+fim
conteudo=textract.process(ficheiro)
print(conteudo.decode('utf-8'))
array=['instrucoes']
imprimir(array[0])
He’s probably not finding the file because of the relative path. Do a test, put the file in the /tmp folder, for example, and instead of putting the path as
./
, which is relative, mount an absolute path as/tmp/instrucoes.pdf
– FBidu
i tried to put all the way from the root and even then it didn’t work but I’ve been watching and it will q a raw string solves my problem?
– Hugo Barbosa
hmm I don’t know if rawstring would solve you no. Just to confirm, are you on a linux system? If you can, copy the error that appears and ask the question
– FBidu