ioerror for just open txt file on windows server 2016

Asked by Muhammad on 2021-02-18

f = open("C://test","r")

for line in f.readlines(0):

    (a, b) = line.strip().split()

    test.append([a.strip(), b.strip()])
but the script stopped and give this, anyone know why is this?
 IOError ( (2, 'No such file or directory', 'C://test') )

[error] --- Traceback --- error source first

line: module ( function ) statement

4: main ( <module> ) f = open("C://test","r")

[error] --- Traceback --- end -------------

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2021-02-24
Last reply:
2021-02-25
Manfred Hampl (m-hampl) said : #1

Use double backslashes ("C:\\test") or single backslashes with raw text (r"C:\test")

Muhammad (babaoriley) said : #2

not work too, \ or /?
f = open(r"C:\test")? right?

RaiMan (raimund-hocke) said : #3

correct filename? what about the extension?

Can you help with this problem?

Provide an answer of your own, or ask Muhammad for more information if necessary.

To post a message you must log in.