BinaryStream.Open - IOException error 1

Hi all,

Got a strange one that I can’t fathom.

Creating f as a folder item, which exists and isReadable (confirmed in debugger)…

As soon as method gets to this line:

inputStream = BinaryStream.Open(f, False)

f.isReadable goes to false!

Anyone have a clue what’s going on here?


I took BinaryStream.Open example code from the Language Reference (OnLine), put it in a PushButton and run:

works fine.

Xojo version?
Windows, Mac or Linux?
Can you replicate in a sample project?

Hi AlertoD,

2024r1, MacOS… I’ll try and cobble together a small project.


If Open fails then the file is not accessible (permissions?).

It could be that whatever initially sets Readable to true doesn’t test everything so the true state isn’t known until Open is performed.

Personally, I wouldn’t bother with the extra I/O overhead of checking if the file is readable before opening it as you should be handling if the file fails to open anyway.

Hi Emile,

I’m not getting that and, after putting this code in brand new project it worked! So something maybe about my main app not being able to access files on my desktop.

Interesting (to confirm this) - I used a shell (myShell.Executive("cat " + f.shellPath) and this returned “operation not permitted”. When I run this in the terminal app, it’s OK. So a permission things somewhere!


You do not say where you put the file …

1 Like

It’s odd as when I do a ‘ls -a ’ in terminal, that suggests (rightly so) that I have full access to the file as I created it.


Sorry Emile, it’s a test file that’s in my desktop folder.

If you are on macOS then it prompts the first time an app accesses a file in certain folders. Maybe you clicked the option to not allow access.

My main app didn’t ask - I can’t recall hitting the option to not allow access. (the test app does prompt for permission as you said)… is there a way to reset the warning in my main app somehow?

In Big Sur you can check System Preferences > Security & Privacy > Files and Folders.
Not sure if it is the same on other version of macOS.

Have a look at tccutil.

tccutil reset All com.yourcompany.yourapp
would reset the system.

Thanks Arnaud, that has fixed it! Regards.