0

Im trying to get paths in a list.txt, one per line, then copy a line and paste in a program prompt, but it keeps me saying "file not found", if I paste the copied line in a notepad, then copy/paste with the mouse the text in notepad into the prompt program, it works. I dont know if there is some hidden instruction in pyperclip.copy that is doing this failure. I cant use pyautogui.typewrite(line) becouse my folders have accents and typewrite mess with then.

ProjectFile = io.open('D:\master\list.txt', 'r',encoding="utf8")
lines = ProjectFile.readlines()  
        
for line in lines: 
                   
#pyautogui.typewrite(line) 

print(line)
pyperclip.copy(str(line))
pyautogui.hotkey("ctrl", "v")
          
ProjectFile.close 
rafael
  • 11
  • 3

1 Answers1

0

just got it, have to remove the breakline.

 pyperclip.copy((str(line)).replace("\n", ""))
rafael
  • 11
  • 3