Permission denied on pdf startup in Linux Mint

Deploying to Linux? Get penguinated here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Rob van der Sloot
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 78
Joined: Sat Apr 17, 2010 9:21 am

Permission denied on pdf startup in Linux Mint

Post by Rob van der Sloot » Mon Apr 19, 2021 2:09 pm

I need to startup pdf files from my application in Linux Mint.(Ubuntu)

I have put : get shell("/home/rob/Documents/Manuals/Manual.pdf") in a mouseUp script

I have set all the directories permissions to "Read and write"

When the script is set to run I get the following message in the it variable: /bin/sh: 1:/home/rob/Documents/Manuals/Manual.pdf: Permission denied.

What do I do wrong?

Thanks
Rob

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Permission denied on pdf startup in Linux Mint

Post by bogs » Mon Apr 19, 2021 2:24 pm

Rob van der Sloot wrote:
Mon Apr 19, 2021 2:09 pm
I need to startup pdf files from my application in Linux Mint.(Ubuntu)

I have put : get shell("/home/rob/Documents/Manuals/Manual.pdf") in a mouseUp script
Just out of curiousity, why not just use -

Code: Select all

on mouseUp
   launch document "/home/rob/Documents/Manuals/Manual.pdf"
end mouseUp
Image

Rob van der Sloot
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 78
Joined: Sat Apr 17, 2010 9:21 am

Re: Permission denied on pdf startup in Linux Mint

Post by Rob van der Sloot » Mon Apr 19, 2021 4:46 pm

launch document "/home/rob/Documents/Manuals/Manual.pdf" does not work in Linux

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Permission denied on pdf startup in Linux Mint

Post by bogs » Mon Apr 19, 2021 10:19 pm

Rob van der Sloot wrote:
Mon Apr 19, 2021 4:46 pm
launch document "/home/rob/Documents/Manuals/Manual.pdf" does not work in Linux
It works here on Linux (with a path to one of my local files), which version of Lc are you using, and which version of Mint? Are you positive the file is located at the path you provided?
Image

wsamples
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 262
Joined: Mon May 18, 2009 4:12 am

Re: Permission denied on pdf startup in Linux Mint

Post by wsamples » Mon Apr 19, 2021 10:40 pm

'launch document' also works here in Arch Linux. 'get shell' is not going to work. Try typing the path to any non executable document in a terminal and see what happens. That's what you're doing when you use 'get shell("/some/path/to/non-executable")'

Rob van der Sloot
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 78
Joined: Sat Apr 17, 2010 9:21 am

Re: Permission denied on pdf startup in Linux Mint

Post by Rob van der Sloot » Tue Apr 20, 2021 9:08 am

I always used "launch" to startup an app in windows10.
I made a copy of my W10 app to Linux.

But then it did not work, so I looked in the Dictionary, where it says: To work with Unix "use the shell function instead"

I had never used "launch document"

Now it works fine. Problem solved, thanks.

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Permission denied on pdf startup in Linux Mint

Post by bogs » Tue Apr 20, 2021 11:25 am

Now it works fine. Problem solved, thanks.
Glad to hear it!
But then it did not work, so I looked in the Dictionary, where it says: To work with Unix "use the shell function instead"

I had never used "launch document"
Launch will also work on 'nix, but for some things, like a .pdf file for instance, you would have to add the application using "with". For instance,
launch "'~/.runrev/components/livecodecommunity-6.5.2/Release Notes.pdf'" with okular
... would also work. {If your on a current Mac, you would probably need to add the .app to whatever program your calling.}

To use shell to open a .pdf (or most things, really) like you would in windows on 'nix, you'd have to refer to the most generic format to call the default set in the OS, which would be "xdg-open".

Code: Select all

shell("xdg-open '~/.runrev/components/livecodecommunity-6.5.2/Release Notes.pdf'")
You might notice that if there are any spaces in the path to the file, such as are between "release" and "notes", you have to enclose the path in single quotes, like 'my path', within the quotes around the shell command. I would say just for safety, do that anyway, if not needed it doesn't present an issue, if needed, it may save your sanity :twisted:

If you want the file to open in a specific application instead of the default, you would simply place that application name in front of the path instead of xdg-open, like so {the following assumes Okular is installed, substitute whatever program your looking for instead}...

Code: Select all

shell("okular '~/.runrev/components/livecodecommunity-6.5.2/Release Notes.pdf'")
So, to wrap up, if your launching something like an .html file, it is probably ok to just use 'launch', but if it is a document, either include what app it should be launched with, or use 'launch document'.

On 'nix at least, to launch it from shell, try "xdg-open" first, or test to see if there is a specific program you want it to open in by throwing "put" or "get" in front in the message box, like so...

Code: Select all

put shell("xdg-open '~/.runrev/components/livecodecommunity-6.5.2/Release Notes.pdf'")
...which will tell you any problems you might have opening the file.

Have fun :D
Image

wsamples
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 262
Joined: Mon May 18, 2009 4:12 am

Re: Permission denied on pdf startup in Linux Mint

Post by wsamples » Tue Apr 20, 2021 2:35 pm

Keep in mind that using the 'shell()' function to launch an application is blocking unless you take special precautions to overcome that. It's not difficult but you have to be aware of the problem and know a solution :) . There are several threads here (search "shell non-blocking") which discuss that if you're interested.

Good luck!

Edit: blocking in this case means your LiveCode application won't normally respond in any way so long as the application opened with 'shell()' is running.

Post Reply

Return to “Linux”