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:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Manfred Hampl (m-hampl) said :
#1

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

Revision history for this message
Muhammad (babaoriley) said :
#2

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

Revision history for this message
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.