Greetings,
I am trying to open a text file named “simple-textfile’ on my NetBrain Desktop in a Python Script Module inside a Qapp but am receiving the following error message:
OSError: EErrno 22] Invalid Argument: ‘nbfile://Desktop/simple-textfile’
How can I get Python to read or interpret the filepath and open it for parsing?
Snippet Python Script:
jfile = $Input1.jfile
with open(jfile, ‘r’) as f:
asdf = f.read()
AddMessage(asdf)
$Input1.jfile is “nbfile://Desktop/sample-textfile”
I tested the filepath with os and it returns that the filepath does not exist:
import os
if os.path.exists(jfile):
AddMessage(“The file path exists”)
else:
AddMessage(“the file path does not exist”)
Result:
“The file path does not exist.”
Any help is greatly appreciated!
Best Regards,
Dave