happy to hear that your OAD macro works great.
File.Exists(path) is not an OAD command.
This is one of the strengths of OAD that you can import .Net DLLs e.g., from the .Net Framework, and use them!
You get class File by importing from System.IO at the beginning of your code.
In your case:
from System.IO import Path, File
Please be aware that the existence of a file does not necessarily mean that you can read it.
E.g. the file exists during the write process but you cannot read it at that time.
You might need some additional code like.
Code: Select all
fs = File.Open(filename + '_minVar.txt', FileMode.Open)
canRead = fs.CanRead
canWrite = fs.CanWrite
fs.Close()
fs.Dispose()
from System.IO import Path, File, FileMode
I hope this helps to make your macro perfect.