Black Lives Matter. Please consider donating to Black Girls Code today.

How can be traced a loading / request error of plotly?

Hi all,

I have been diving into both documentation and this forum and I haven’t been able to find any information about a weird problem with plotly

Last friday some scripts of mine works in my pc (WSL1) seamessly. One of them, for instance, includes a go.Scatter chart which worked until last friday and that works on google colab. Without fig.show or pio.write_htmlthe script works also on my WSL1 box, so I assume that it is a problem related with plotly installation.

Today I have tried to run them again and a Request sent message appears on the terminal. After a good number of minutes, this other message appears

image

if I comment fig.show() and I just permit something like

pio.write_html(fig, file=filename, auto_open=True)

a message like this appears on the terminal

image

and after a lot of minutes the error loading message appears again

I have tried to run the script on a different virtualenv, to install and uninstall plotly, but for no avail. No matter what I do, it doesn’t work.

the traceback of the terminal after KeyboardInterrupt is this

Traceback (most recent call last):
  File "genera_timeline_plotly.py", line 115, in <module>
    pio.write_html(fig, file=nombrearchsalida, auto_open=True)
  File "/mnt/d/Dropbox/oando/PP/PP Madrid/timeline rural/venv/lib/python3.6/site-packages/plotly/io/_html.py", line 543, in write_html
    webbrowser.open(url)
  File "/usr/lib/python3.6/webbrowser.py", line 60, in open
    if browser.open(url, new, autoraise):
  File "/usr/lib/python3.6/webbrowser.py", line 146, in open
    return not p.wait()
  File "/usr/lib/python3.6/subprocess.py", line 1477, in wait
    (pid, sts) = self._try_wait(0)
  File "/usr/lib/python3.6/subprocess.py", line 1424, in _try_wait
    (pid, sts) = os.waitpid(self.pid, wait_flags)
KeyboardInterrupt

I also assume that python or plotly is waiting for something

Has somebody experienced something like this?

Does somebody figure out how to solve this problem?

thanks in advance!

After trying a lot of different options, I decided to take the wild path and install windows 10 v2004 with WSL2. It looked like all was fine…

… until you have a script includes a call to the browser, such as fig.show. Then, a nice and undescipherable error messages will arise directly from doom:

Start : Este comando no se puede ejecutar debido al error: El sistema no puede encontrar el archivo especificado.
En línea: 1 Carácter: 1
+ Start "file:///mnt/somedamnpath/timeli ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException
    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand

Thing is, wsl doesn’t know how to point to the default browser

After digging here and there, I’ve found a solution:

$export BROWSER=/mnt/path/to/your/msedge.exe

or wherever the path to your default browser is

however, apparent niceties such as export BROWSER=wslview doesn’t work.

I hope that this help somebody in the future