Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show_instrument() problems #61

Open
riwa73 opened this issue Mar 31, 2023 · 1 comment
Open

show_instrument() problems #61

riwa73 opened this issue Mar 31, 2023 · 1 comment

Comments

@riwa73
Copy link

riwa73 commented Mar 31, 2023

I ran into two issues in the show_instrument() functionality of macstasscript (version "0.0.55").

  1. Windows 10
    show_instrument() only works if one hacks the call: to mcdisplay-webgl i.e without path and " " (see below)
    It fails otherwise. I think it is somehow caused by jupyter lab running in the dedicated mcstas-shell
if is_notebook and executable == "mcdisplay-webgl" and not new_tab:
            options += "--nobrowse "

        full_command = ('"' + bin_path + executable + '" '
                        + dir_control
                        + options
                        + instr_path
                        + " " + parameter_string)
      
        new_full_command = (executable + ' '
                        + dir_control
                        + options
                        + instr_path
                        + " " + parameter_string)
       

        process = subprocess.run(new_full_command, shell=True,
                                 stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE,
                                 universal_newlines=True,
                                 cwd=self.input_path)
  1. Windows and MacOs:
    I get only the (empty) output in the notebook cell:
    image

    new_tab=True opens a new browser tab and works as intended
    IFrame() seems to find the html but not the js files

@riwa73
Copy link
Author

riwa73 commented Apr 18, 2023

A short update/remark -
on

  • Ubuntu 22.04, Firefox
  • MacOS M1 - Safari
    the problem does not appear. The instrument visualisation can be opened in the notebook cell.

The issue seems to be caused by the implementaion of the "Blocking Cross Origin" policy (CORS)
in certain browsers in certain operating systems.
It is triggered when Jupyter is trying to open an local html file that again loads some javascript files.
Interestingly opening the same html in a new tab succeeds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant