I am trying to run a python script on a linux server and it needs to access a list on a text file - saved in the same location that I'm running the script.
This might be just a simple formatting issue but I've tried various ways and still no luck.
Here is the code in my python file:
list1 = session.target_list("C:\\root\\instapy-quickstart\\apples.txt")
session.follow_by_list(list1)
Getting the error:
No such file or directory: C:\root\instapy-quickstart\apples.txt
Pat. ANDRIA
2,4401 gold badge16 silver badges31 bronze badges
1 Answer 1
If the file is in the same location, why you don't use the name of the file without pathway? I mean:
list1 = session.target_list("apples.txt")
answered Nov 14, 2020 at 11:37
Reihaneh Kouhi
5692 gold badges8 silver badges26 bronze badges
Sign up to request clarification or add additional context in comments.
1 Comment
Reihaneh Kouhi
@mattygee happy to hear that :).
lang-py
/home/your_user/file.txt. Alternatively, you can specify file location relative to the place you're running your script from, like./apples.txtsession.target_list(r"C:\root\instapy-quickstart\apples.txt")- note therbefore the quote. Or just use forward slashes, even on Windows.