Skip to content
New issue

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

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

Already on GitHub? # to your account

Embed image with url in notebook #18

Open
cast42 opened this issue Jan 29, 2020 · 2 comments
Open

Embed image with url in notebook #18

cast42 opened this issue Jan 29, 2020 · 2 comments

Comments

@cast42
Copy link

cast42 commented Jan 29, 2020

When the notebook to be published containts a url to the internet, the convertion of the notebook to a post gives an error.

I tried three options:

  1. Embed using markup
![Example Bullet Chart](https://jscharting.com/blog/bullet-charts/images/bullet_components.png)
  1. Embed using Image
from IPython.display import Image
Image('https://jscharting.com/blog/bullet-charts/images/bullet_components.png')
  1. Embed as HTML
<img src="https://jscharting.com/blog/bullet-charts/images/bullet_components.png" alt="Bullet chart" style="width: 200px;"/>

In case 3, this is the error in (https://github.com/cast42/cast42.github.io/runs/415599290?check_suite_focus=true):

converting: _notebooks/2020_01_29_bullet_chart_altair.ipynb
[Errno 2] No such file or directory: '/home/runner/work/cast42.github.io/cast42.github.io/_notebooks/https:/jscharting.com/blog/bullet-charts/images/bullet_components.png'
converting: _notebooks/2020-01-28-Altair.ipynb
Traceback (most recent call last):
  File "_action_files/nb2post.py", line 23, in <module>
    export2html.notebook2html(fname='_notebooks/*.ipynb', dest='_posts/')
  File "/home/runner/work/cast42.github.io/cast42.github.io/nbdev/nbdev/export2html.py", line 410, in notebook2html
    raise Exception(msg + '\n'.join([f.name for p,f in zip(passed,files) if not p]))
  File "/home/runner/work/cast42.github.io/cast42.github.io/nbdev/nbdev/export2html.py", line 410, in <listcomp>
    raise Exception(msg + '\n'.join([f.name for p,f in zip(passed,files) if not p]))
AttributeError: 'str' object has no attribute 'name'
##[error]Process completed with exit code 1.
@cast42 cast42 changed the title Embed image on webin notebook Embed image with url in notebook Jan 29, 2020
@hamelsmu
Copy link
Member

hamelsmu commented Jan 30, 2020

@cast42 any chance you have a public link to your notebook so I can take a look? nevermind that is not necessary, I'm taking a look now

@hamelsmu
Copy link
Member

hamelsmu commented Jan 30, 2020

@cast42 I looked into this and this looks like a limitation with nbdev ( I believe that only images sourced from your local files are supported, not links but not 100% sure ) , perhaps you should file an issue in https://github.com/fastai/nbdev/

I did open a PR as you did encounter a bug with the error handling though!

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

No branches or pull requests

2 participants