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

Warn and do-not-pass non-compliant stderr objects to Popen #233

Open
ayjayt opened this issue Dec 5, 2024 · 0 comments
Open

Warn and do-not-pass non-compliant stderr objects to Popen #233

ayjayt opened this issue Dec 5, 2024 · 0 comments
Assignees
Labels
active P1 needs immediate attention TNG related to next-generation architecture

Comments

@ayjayt
Copy link
Collaborator

ayjayt commented Dec 5, 2024

I've had trouble with exporting/streaming figures to svg on Windows 10 and 11 as well, with the process just running indefinitely. As suggested here, I've been using kaleido==0.1.0.post1 in the meantime.

Today, I tested kaledio versions 0.4.0.rc3 and 1.0.0.rc0 with python 3.10.11 as well as 3.12.0, in the hopes for a change.

Unfortunately, they still hang forever.

Maybe the following report helps to narrow it down?

PS: Not sure whether to post it here ore in #223

System: Windows 11, VSCode 1.95.3 (Notebook)

Test code

import os
import plotly.graph_objects as go

os.environ["KALEIDO_DEBUG"] = "1"

fig = go.Figure()

fig.add_annotation(
    x=0.5,
    y=0.5,
    xref="paper",
    yref="paper",
    text="Hello World",
    showarrow=False,
    font=dict(size=12, color="#ff0000"),
)

fig.write_image("test_kaleido.svg")
fig.show()

Output before hanging forever (python 3.12.0, kaleido 1.0.0.rc0)

Tempdir: C:\Users\<REDACTED>\AppData\Local\Temp\tmp1mn_17ho
************Displaying generated HTML*************
<!DOCTYPE html>
<html>
  <head>
    <style id="head-style"></style>
    <title>Kaleido-fier</title>
    <script>
        window.KaleidoReport = ["start"];
        function logError(e) {
            window.KaleidoReport.push("error");
            window.KaleidoReport.push(e);
            if (!navigator.onLine) {
                window.KaleidoReport.push("offline");
            }
        }
    </script>
    <script>
      window.PlotlyConfig = {MathJaxConfig: 'local'}
    </script>
 <script src="https://cdn.plot.ly/plotly-2.35.2.min.js" charset="utf-8" onerror="logError('plotly')"></script>
 <script type="text/javascript" id="MathJax-script" src="file:///c:/Users/<REDACTED>/envs/<REDACTED>/Lib/site-packages/kaleido/vendor/mathjax/MathJax.js?config=TeX-AMS-MML_SVG" onerror="logError('mathjax')"></script>
    <script src="file:///c:/Users/<REDACTED>/envs/<REDACTED>/Lib/site-packages/kaleido/vendor/kaleido_scopes.js" onerror="logError('scoper')"></script>  </head>
  <body style="{margin: 0; padding: 0;}"><img id="kaleido-image"><img></body>
</html>
***********************end************************
************Displaying generated HTML*************
<!DOCTYPE html>
<html>
  <head>
    <style id="head-style"></style>
    <title>Kaleido-fier</title>
    <script>
        window.KaleidoReport = ["start"];
        function logError(e) {
            window.KaleidoReport.push("error");
            window.KaleidoReport.push(e);
            if (!navigator.onLine) {
                window.KaleidoReport.push("offline");
            }
        }
    </script>
    <script>
      window.PlotlyConfig = {MathJaxConfig: 'local'}
    </script>
 <script src="file:///c:/Users/<REDACTED>/envs/<REDACTED>/Lib/site-packages/plotly/package_data/plotly.min.js" charset="utf-8" onerror="logError('plotly')"></script>
 <script type="text/javascript" id="MathJax-script" src="file:///c:/Users/<REDACTED>/envs/<REDACTED>/Lib/site-packages/kaleido/vendor/mathjax/MathJax.js?config=TeX-AMS-MML_SVG" onerror="logError('mathjax')"></script>
    <script src="file:///c:/Users/<REDACTED>/envs/<REDACTED>/Lib/site-packages/kaleido/vendor/kaleido_scopes.js" onerror="logError('scoper')"></script>  </head>
  <body style="{margin: 0; padding: 0;}"><img id="kaleido-image"><img></body>
</html>
***********************end************************
Got running loop, threading
Calling thread start
Calling to_image in thread
c:\Users\<REDACTED>\envs\<REDACTED>\Lib\site-packages\choreographer\browser.py:85: UserWarning:

A value has been passed to debug_browser which is not compatible with python. The default value if deug_browser is True is whatever the value of sys.stderr is. sys.stderr may be many things but debug_browser must be a value Popen accepts for stderr, or True.

STDERR: <ipykernel.iostream.OutStream object at 0x0000021B9FBEB6D0>
TEMP DIR NAME: C:\Users\<REDACTED>\AppData\Local\Temp\tmp9h8jc2d9
DEBUG REPORT:
BROWSER_PATH: C:\Program Files\Google\Chrome\Application\chrome.exe
USER_DATA_DIR: C:\Users\<REDACTED>\AppData\Local\Temp\tmp9h8jc2d9
We are in a selector event loop, use loop_hack
read_jsons (blocking):
Task exception was never retrieved
future: <Task finished name='Task-6' coro=<Browser._open_async() done, defined at c:\Users\<REDACTED>\envs\<REDACTED>\Lib\site-packages\choreographer\browser.py:246> exception=UnsupportedOperation('fileno')>
Traceback (most recent call last):
  File "c:\Users\<REDACTED>\envs\<REDACTED>\Lib\site-packages\choreographer\browser.py", line 264, in _open_async
    self.subprocess = await open_browser(to_chromium=self.pipe.read_to_chromium,
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python312\Lib\asyncio\threads.py", line 25, in to_thread
    return await loop.run_in_executor(None, func_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python312\Lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\<REDACTED>\envs\<REDACTED>\Lib\site-packages\choreographer\chrome_wrapper.py", line 76, in run
    return subprocess.Popen(
           ^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python312\Lib\subprocess.py", line 992, in __init__
    errread, errwrite) = self._get_handles(stdin, stdout, stderr)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python312\Lib\subprocess.py", line 1406, in _get_handles
    errwrite = msvcrt.get_osfhandle(stderr.fileno())
                                    ^^^^^^^^^^^^^^^
  File "c:\Users\<REDACTED>\envs\<REDACTED>\Lib\site-packages\ipykernel\iostream.py", line 371, in fileno
    raise io.UnsupportedOperation(msg)
io.UnsupportedOperation: fileno

Originally posted by @maximweb in #110

Hi @maximweb,

Thanks for this, I have a pretty good idea of what it is. I should be able to get it fixed tomorrow.

@ayjayt ayjayt added active P1 needs immediate attention TNG related to next-generation architecture labels Dec 5, 2024
@ayjayt ayjayt self-assigned this Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
active P1 needs immediate attention TNG related to next-generation architecture
Projects
None yet
Development

No branches or pull requests

1 participant