# Error message when running via Voila but the notebook is working well at Jupyter

**URL:** <https://discourse.jupyter.org/t/error-message-when-running-via-voila-but-the-notebook-is-working-well-at-jupyter/18191>\
**Category:** Notebook\
**Created:** [February 27, 2023, 9:09pm UTC](https://discourse.jupyter.org/t/error-message-when-running-via-voila-but-the-notebook-is-working-well-at-jupyter/18191 "2023-02-27T21:09:59Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daoer](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/daoer/32/9240_2.png) [@Daoer](https://discourse.jupyter.org/u/Daoer)\
**Post date:** [February 27, 2023, 9:09pm UTC](https://discourse.jupyter.org/t/error-message-when-running-via-voila-but-the-notebook-is-working-well-at-jupyter/18191/1 "2023-02-27T21:09:59Z")

</div>

I am currently working on FileUpload/download from ipywidgets. When I run my notebook at Jupyter, the notebook is going well but when I tried to run this notebook via Voila. The error message ‘here was an error when executing cell [8]’ appeared. Moreover, the notebook supports to have both upload and download button but only upload button showed via Voila. The link for my notebook is [GitHub - yuxuan7z/communication\_voila](https://github.com/yuxuan7z/communication_voila) Really appreciate any suggestion on my notebook. Thank you 😀

---

<div class="post-metadata">

**Author:** ![fomightez](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/fomightez/32/495_2.png) [@fomightez](https://discourse.jupyter.org/u/fomightez)\
**Post date:** [February 27, 2023, 9:50pm UTC](https://discourse.jupyter.org/t/error-message-when-running-via-voila-but-the-notebook-is-working-well-at-jupyter/18191/2 "2023-02-27T21:50:51Z")

</div>

What do you specifically mean by “When I run my notebook at Jupyter”? What is your “at Jupyter”?

If you are getting an error message when trying to use Voila I’m not seeing how you get to see it doesn’t show a download button. It usually won’t open if there is an error.

When I run your code in JupyterLab and Voila, I get the this error below, **which is different than report** :

```python
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
/tmp/ipykernel_167/702361175.py in <module>
      2 import pandas as pd
      3 
----> 4 uploaded_file = upload.value[0]
      5 
      6 

IndexError: tuple index out of range

```

So what your are seeing isn’t reproducible.

If I change the code to rely on actual `csv` file to be read in as `df` (since upload step fails) then the rest of the code works in JupyterLab. It saves a smaller version of the dataframe I used in the `df = pd.read_csv` line in the same directory alongside the notebook I was working in. Saves it as `output.csv`.

If I remove the code with the upload button and the line `uploaded_file = upload.value[0]`. Then everything runs in Voila and it saves the `out.csv` file again when I press the `Download File` button.

* * *

You can see the same thing in launches from your repo [here](https://mybinder.org/v2/gh/yuxuan7z/communication_voila/HEAD?urlpath=%2Flab%2Ftree%2FUpload_download.ipynb).  
Although clicking on the Voila icon won’t give the specific error. Given everything else seems the same, from where I ran it, I assume it is the same error in Voila that the notebook gives. Where I ran your notebook and tested I had the this file [jupyter\_config.json](https://github.com/fomightez/communication_voila/blob/a1789ae96df0ef73a33013c524bc02e8e62c53ea/jupyter_config.json) in the root of my repo so the Voila errors were more informative.

---

<div class="post-metadata">

**Author:** ![Daoer](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/daoer/32/9240_2.png) [@Daoer](https://discourse.jupyter.org/u/Daoer)\
**Post date:** [February 28, 2023, 1:43pm UTC](https://discourse.jupyter.org/t/error-message-when-running-via-voila-but-the-notebook-is-working-well-at-jupyter/18191/3 "2023-02-28T13:43:22Z")

</div>

Thank you so much for your reply. I did not state my myself clearly. I try to create a notebook includes both upload and download button. When I run this notebook at Jupyter notebook, I could see both buttons but when I opened this notebook via voila, only upload button showed with error message ‘tuple out of index’. I could not figure out why there is an error message only appears via voila. Is the mistake part about upload button? Thank you

---

<div class="post-metadata">

**Author:** ![fomightez](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/fomightez/32/495_2.png) [@fomightez](https://discourse.jupyter.org/u/fomightez)\
**Post date:** [February 28, 2023, 1:56pm UTC](https://discourse.jupyter.org/t/error-message-when-running-via-voila-but-the-notebook-is-working-well-at-jupyter/18191/4 "2023-02-28T13:56:42Z")

</div>

I put a link where you can see exactly what I see (by clicking [here](https://mybinder.org/v2/gh/yuxuan7z/communication_voila/HEAD?urlpath=%2Flab%2Ftree%2FUpload_download.ipynb)).  
The Download button code won’t run to make that button display because it is downstream of the upload button that has an error. It’s just like a normal notebook. It kicks out at the first error and so it doesn’t try to do things past that.  
You still haven’t described what you mean by “at Jupyter”?

---

<div class="post-metadata">

**Author:** ![Daoer](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/daoer/32/9240_2.png) [@Daoer](https://discourse.jupyter.org/u/Daoer)\
**Post date:** [February 28, 2023, 2:18pm UTC](https://discourse.jupyter.org/t/error-message-when-running-via-voila-but-the-notebook-is-working-well-at-jupyter/18191/5 "2023-02-28T14:18:05Z")

</div>

‘at Jupyter’ I mean when I run the notebook at Jupyter notebook there is no error but error message showed via voila. Now I got your point. Yes, the notebook you had is the same as I have. Could you please guide me how to avoid this error message ‘tuple out of index’? Really appreciate it.

---

<div class="post-metadata">

**Author:** ![Daoer](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/daoer/32/9240_2.png) [@Daoer](https://discourse.jupyter.org/u/Daoer)\
**Post date:** [February 28, 2023, 3:02pm UTC](https://discourse.jupyter.org/t/error-message-when-running-via-voila-but-the-notebook-is-working-well-at-jupyter/18191/6 "2023-02-28T15:02:25Z")

</div>

It seems like voila run all cells from the notebook at the same time to me. That’s why the error message ‘tuple out of index’ because there is no file for download button to download. But Jupyter Notebook run cells one by one and so upload file is ready to download

---

<div class="post-metadata">

**Author:** ![fomightez](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/fomightez/32/495_2.png) [@fomightez](https://discourse.jupyter.org/u/fomightez)\
**Post date:** [February 28, 2023, 3:55pm UTC](https://discourse.jupyter.org/t/error-message-when-running-via-voila-but-the-notebook-is-working-well-at-jupyter/18191/7 "2023-02-28T15:55:05Z")

</div>

> [@Daoer](#):
>
> It seems like voila run all cells from the notebook at the same time to me. That’s why the error message ‘tuple out of index’ because there is no file for download button to download. But Jupyter Notebook run cells one by one and so upload file is ready to download

Yes, exactly. Voila runs all the code first to initiate things. You have to build in methods to deal with that and then how to handle the next steps. It seems you are just using some basic code that makes the buttons themselves and not building in the handling. See the thread here from [this point forward](https://discourse.jupyter.org/t/pause-appmode-to-wait-for-user-input/12094/2) to give you some pointers how to deal with the upload.
