Jump to content

Open an html file with google chrome under NI Linux


CIPLEO

Recommended Posts

Hello, 

I'm trying to open an HTML file in google chrome via the VI System Exec.vi under NI Linux, for this I had to install the "xdg-utils" package. With the Linux terminal the command "xdg-open [file path] works fine. However, when I execute the code with LabVIEW the VI returns the following error (standard error indicator): 

 

/usr/bin/xdg-open: line 779: www-browser: command not found
/usr/bin/xdg-open: line 779: links2: command not found
/usr/bin/xdg-open: line 779: elinks: command not found
/usr/bin/xdg-open: line 779: links: command not found
/usr/bin/xdg-open: line 779: lynx: command not found
/usr/bin/xdg-open: line 779: w3m: command not found
xdg-open: no method available for opening '/home/lvuser/Desktop/Reports/20221128/FileHTML.html'

 

After some research I understood that this was due to the fact that the default opening of the file is not goole chrome. So I executed the following commands in the terminal:

- xdg-mime query default x-scheme-handle/http 

- xdg-mime query default x-scheme-handle/https

- xdg-mime query default text/html

 

But nothing does with LabVIEW it does not work but works with the Linux terminal.

I join you the code (using LabVIEW 2020). Thanks for your feedback.

code.png

code.vi

Link to comment
  • 2 weeks later...

Just a guess, but it could be the shell that LabVIEW starts does not have the BROWSER environment variable set.

https://superuser.com/questions/1524059/how-to-set-default-variable-for-a-single-command-with-env-variables

Add BROWSER='chromium' to your system exec command line string:

     BROWSER='chromium' xdg-open 'https://startpage.com'
Edited by Phillip Brooks
Link to comment

Hello, 

So I tried the command line: 

BROWSER='chromium' xdg-open 'https://startpage.com'

It still doesn't work but the error is different I get:

/usr/bin/xdg-open: line 779: chromium: command not found
/usr/bin/xdg-open: line 779: chromium: command not found
xdg-open: no method available for opening 'https://www.google.fr'

PS : here I try to open only a google page 

 

I had seen on some forums that modifying the "xdg-open" file would be a solution but I didn't dare to touch it. I did add "chromium" to the second line of a part of the file. 

if [x"$BROWSER" = x""]; then
     BROWSER=www-browser:links2:elinks:links:lynx:w3m:chromium

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.