Clear Filters
Clear Filters

Exporting live script files using export fails in pipeline

2 views (last 30 days)
I have a number of .mlx source files which I want to export into html, pdf, and ipynb files using export with the option Run=true as part of my CI pipeline in GitLab. In the next stage, the html files to be deployed into a documentation bucket. MATLAB produces the following internal error with the code 267. The -batch option also fails.
Q1: Is there any help for resolving 267?
Q2: Is export able to produce output files purely from the linux command line (without needing a display)?
Q3: Is there any other recommended way of producing html files in a CI pipeline in batch mode?
$ matlab -display xDisp -sd docs -r build_docs
MATLAB is selecting SOFTWARE OPENGL rendering.
< M A T L A B (R) >
Copyright 1984-2023 The MathWorks, Inc.
R2023b Update 6 (23.2.0.2485118) 64-bit (glnxa64)
December 28, 2023
To get started, type doc.
For product information, visit www.mathworks.com.
{Error using matlab.internal.cef.webwindow
MATLABWindow application failed to launch. Unable to launch the MATLABWindow
application. The exit code was: 267
Error in matlab.internal.liveeditor.LiveEditorUtilities.createDocument (line 26)
webWindow = matlab.internal.cef.webwindow(url, matlab.internal.getDebugPort);
Error in matlab.internal.liveeditor.LiveEditorUtilities.open>openUsingCEF (line 109)
[javaRichDocument, webWindow] = LiveEditorUtilities.createDocument(timeout);
Error in matlab.internal.liveeditor.LiveEditorUtilities.open (line 33)
[javaRichDocument, cleanupObj, webWindow] = openUsingCEF(fileName, reuse, timeout, webWindow);
Error in export (line 116)
matlab.internal.liveeditor.LiveEditorUtilities.open(...
Error in build_docs (line 9)
export(fname,Run=true,Format='ipynb')
}

Accepted Answer

Swastik
Swastik on 22 Mar 2024
It appears you are encountering an issue with error 267 when attempting to generate PDF, HTML, or IPYNB files from a “.mlx” file using the MATLAB export command. You have also mentioned using an “xDisp” for display purposes, though the details of this XServer display are not entirely clear.
The core of the issue seems related to the absence of a graphical display environment, which is required for certain MATLAB operations, including the export functionality you are trying to use.
To overcome this challenge, especially in environments like GitLab CI runners where a physical display is not available, a viable workaround involves the use of “Xvfb”, a virtual framebuffer X server.
Follow the below steps to set it up correctly:
Install and start Xvfb display
apt install xvfb
Xvfb :90& # running fake display server on “:90”
With the Xvfb server running, you can now invoke MATLAB and specify the virtual display. For example, to use display :99 and execute the build_docs operation, you would use
matlab -display :99 -batch "build_docs"
This solution should effectively bypass the error 267 you have been facing by providing a virtual graphical environment for MATLAB's export operations.
I hope this approach resolves your issue and enables you to successfully generate the desired documents from your “.mlx” file in a headless environment like GitLab CI.

More Answers (0)

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Tags

Products


Release

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!