[Gambas-user] Problem with file access

Bruce Steers bsteers4 at gmail.com
Thu May 18 00:37:00 CEST 2023


On Wed, 17 May 2023, 23:10 Dag JNJ, <gambas at cd-bahia.com> wrote:

> Hi all,
> suddenly I have got access denied handling files. In a terminal window
> everything works fine, but from within Gambas I get access denied. I have
>
> *If Exist(dPDF) Then Kill dPDF -> IDE stopps  with access denied message *dPDF
> is the filename of a pdf-file. It worked fine until the afternoon today. I
> tried chmod -r +rw . and chown -r dagj . from the current Application.Path,
> but that changed nothing, Then I tried
>
> *Shell "pdftotext  -layout " & ch3 & dPDF & ch3 & " " & fntxt Wait *fntxt
> is the filename of the output textfile. Result:
>
> *I/O Error: Couldn't open file 'data/AMZ/2020/Amazon.es - Pedido
> 406-4690641-7441902.pdf': No such file or directory. *
> But when I try this in a terminal window (Print instead of Shell and copy
> the result from the Gambas console then paste this into the terminal
> window), it works,
> *pdftotext  -layout "data/AMZ/2020/Amazon.es - Pedido
> 406-4690641-7441902.pdf" "data/AMZ/BEARBEITET/TXT/406-4690641-7441902.txt"*
>
> I am hanging a little  now, and appreciate any help.
> Regards,
> Dag
>

Where is "data" ?

If it's a disk then that code is okay.

If it's a Dir in the project folder then it is wrong.

To use a shell command you will need to save the file to /tmp or somewhere
and have it output it's text there too.

Or use absolute paths to work in project dir with
Application.Path &/ dPDF


BruceS


> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230517/2c91570f/attachment.htm>


More information about the User mailing list