jupyterlab-drawio icon indicating copy to clipboard operation
jupyterlab-drawio copied to clipboard

Export diagram as SVG create an empty file

Open pabepadu opened this issue 3 years ago • 7 comments

Hi,

Since version 0.9, "Export diagram as SVG" create an empty file.

It seems the code to get the SVG content has been commented:

https://github.com/QuantStack/jupyterlab-drawio/blob/a71c3826aa57f149dea36378a434a07d05254077/src/editor.ts#L112-L114

pabepadu avatar Jun 05 '21 17:06 pabepadu

How to fix it? I tried to uncomment the code above, but got some install errors.

$ rimraf lib/drawio && mkdir -p lib/drawio && cp -R src/drawio lib && tsc
    src/editor.ts(113,17): error TS2339: Property 'mx' does not exist on type 'DrawIODocumentWidget'.
    src/editor.ts(113,40): error TS2339: Property '_editor' does not exist on type 'DrawIODocumentWidget'.
    error Command failed with exit code 1.

rushfly avatar Aug 14 '21 23:08 rushfly

Hi @rushfly. The API has changed a little bit. There is a PR ready that will solve that. See: https://github.com/QuantStack/jupyterlab-drawio/pull/99

You can activate this option by adding the following method: https://github.com/QuantStack/jupyterlab-drawio/blob/f3bcb8f20c342a3870c7ac070819278d3896f68f/src/widget.ts#L108

This one in the panel: https://github.com/QuantStack/jupyterlab-drawio/blob/f3bcb8f20c342a3870c7ac070819278d3896f68f/src/panel.ts#L98

And may this changes here: https://github.com/QuantStack/jupyterlab-drawio/blob/f3bcb8f20c342a3870c7ac070819278d3896f68f/src/index.ts#L159

hbcarlos avatar Aug 15 '21 10:08 hbcarlos

Hi @rushfly. The API has changed a little bit. There is a PR ready that will solve that. See: #99

You can activate this option by adding the following method: https://github.com/QuantStack/jupyterlab-drawio/blob/f3bcb8f20c342a3870c7ac070819278d3896f68f/src/widget.ts#L108

This one in the panel: https://github.com/QuantStack/jupyterlab-drawio/blob/f3bcb8f20c342a3870c7ac070819278d3896f68f/src/panel.ts#L98

And may this changes here: https://github.com/QuantStack/jupyterlab-drawio/blob/f3bcb8f20c342a3870c7ac070819278d3896f68f/src/index.ts#L159

hi, dear @hbcarlos

I checkout your branch rtc-using-string and followed the Development install section in README.md , when I'm going to run the script jupyter labextension develop . --overwrite to Link my development version of the extension with JupyterLab, I got this error below:

Traceback (most recent call last):
  File "/Users/xxm/Documents/gitlab/Jupyter/jupyterlab-drawio/setup.py", line 7, in <module>
    from jupyter_packaging import (
ModuleNotFoundError: No module named 'jupyter_packaging'
An error occured.
FileNotFoundError: The Python package `.` is not a valid package, it is missing the `setup.py` file.
See the log file for details:  /var/folders/85/z3660xmj79xdjy3zr9pm__x80000gn/T/jupyterlab-debug-34dg1p3h.log

And the full error log is :

Traceback (most recent call last):

  File "/usr/local/lib/python3.9/site-packages/jupyterlab/federated_labextensions.py", line 376, in _get_labextension_metadata
    package = subprocess.check_output([sys.executable, 'setup.py', '--name'], cwd=mod_path).decode('utf8').strip()

  File "/usr/local/Cellar/[email protected]/3.9.1_2/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 420, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,

  File "/usr/local/Cellar/[email protected]/3.9.1_2/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,

subprocess.CalledProcessError: Command '['/usr/local/opt/[email protected]/bin/python3.9', 'setup.py', '--name']' returned non-zero exit status 1.


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "/usr/local/lib/python3.9/site-packages/jupyterlab/debuglog.py", line 47, in debug_logging
    yield

  File "/usr/local/lib/python3.9/site-packages/jupyterlab/labextensions.py", line 128, in start
    ans = self.run_task()

  File "/usr/local/lib/python3.9/site-packages/jupyterlab/labextensions.py", line 199, in run_task
    develop_labextension_py(arg, user=self.user, sys_prefix=self.sys_prefix, labextensions_dir=self.labextensions_dir, logger=self.log, overwrite=self.overwrite,

  File "/usr/local/lib/python3.9/site-packages/jupyterlab/federated_labextensions.py", line 135, in develop_labextension_py
    m, labexts = _get_labextension_metadata(module)

  File "/usr/local/lib/python3.9/site-packages/jupyterlab/federated_labextensions.py", line 378, in _get_labextension_metadata
    raise FileNotFoundError('The Python package `{}` is not a valid package, '

FileNotFoundError: The Python package `.` is not a valid package, it is missing the `setup.py` file.

Exiting application: lab

Can you help me fix this error ? Or may you know when your PR #99 will be merged ?

Best wishes :)

xiongjiamu avatar Aug 16 '21 16:08 xiongjiamu

Hi @xiongjiamu, you need to install the package jupyter_packaging in the conda environment you are installing JupyterLab-DrawIO. You can use mamba for this mamba install -c conda-forge jupyter-packaging.

I'll try to merge it as soon as possible.

hbcarlos avatar Aug 23 '21 07:08 hbcarlos

I tried the above and it doesn't work for me. I still get empty SVG files when I export to SVG from DrawIO.

skaag avatar Feb 21 '22 18:02 skaag

The Problem still exists, empty SVG file when export diagram as SVG

yxiao315 avatar Jan 14 '23 10:01 yxiao315

Same problem for me!

lbocken avatar Apr 05 '23 12:04 lbocken