IOErrors when using python's open()

Hey folks,

Rather bizarre issue here.

When I run in the maco window:

fi = open('/Users/marc/Documents/glyphs-scripts/try.txt', 'w')
fi.write('foo')
fi.close()

I get:

IOError: [Errno 1] Operation not permitted: ‘/Users/marc/Documents/glyphs-scripts/try.txt’

When I do:

fi = open('try.txt', 'w')
fi.write('foo')
fi.close()

It successfully writes the file. However is saved to:

/Users/marc/Library/Containers/com.schriftgestaltung.Glyphs/Data

This is the same locations as when I run:

import os
print os.getcwd()

I have checked my permissions. I have also pumped the same commands into the terminal and it worked.

I’m using Glyphs Version 1.4.4 (609).

Any advice is greatly appreciated.

Cheers,
Marc

You have the App Store version. It is sandboxed and this disallows the app to write to destinations outside of the apps container. This limitation for scripts is one of the reasons why I dropped the support for the App Store for version 2.

Hey Georg,

I’ll drop you a pm.

Thank you for your reply.

Marc