Perfect IOhannes!

It works! Thanks for the explanation.

Let me finish the patch and I will post it here with a better description of the problems and solutions.

All the best

Luiz Naveda

Luiz Naveda
_____________________________________________________
naveda.info

                                      ^v^         
      ^v^         
                         ^v^         

^~^~^~^~^~^~^~^~~^~~^~~^~^~^~~~^^~^~~~~
^~^~^~^~^~^~^~^~^~^~~^~~^~~^~^~^~~~^~~~

On Sun, May 10, 2015 at 3:02 PM, IOhannes m zmölnig <zmoelnig@iem.at> wrote:
On 05/10/2015 06:35 PM, Luiz Naveda wrote:
> Dear List,
>
> I am trying to write a txt with pdlua (using pdluax) in a Mac (yosemite)
> Everything is clear but I can't solve a permission error:
>
> lua: error in dispatcher:
> [string "txtwrite.pd_luax"]:11: example.txt: Permission denied

that should be unrelated to pdlua.

the problem is, that you do not really know *where* on the filesystem
you are writing the file.
contrary to what you might expect (e.g. besides the "problem.pd" patch),
a simple call to `open()` (and lua's io.open() is just a thing wrapper
around the underlying C-function) will create a file in the working
directory of the calling application - which is determined at startup to
the place where you started Pd from.
since you are on OSX, i assume that you are starting Pd from simply
clicking on the application icon, which IIRC uses the filesystem root
(`/`) as your working directory (at least some older versions of Pd,
probably including Pd-extended).

now in general it's a good thing that you are not allowed to write stuff
in `/`.
the fix is rather easy: provide full pathnames when using low-level file
io-functions. for testing it might be a good idea to use a tempdir, e.g.
/tmp/example.txt

gfdsar
IOhannes


_______________________________________________
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list