Two problems with my python code

Hello everyone ,

I need your help to end my python code.

I've this code in python :

from ipywidgets import interact, Dropdown
from ipywidgets import *
from ipywidgets.embed import embed_minimal_html


import pandas as pd
import os
import sys

#################### Dropdown servers list ####################

Server = os.listdir("/home/tim/Bureau/Servers/")
test = widgets.Dropdown(options = (Server))
Server2 = os.listdir("/home/tim/Bureau/Servers/")

#################### Dropdown date list ####################

Date = ['2019-10', '2019-11', '2019-12', '2020-01']
test2 = widgets.Dropdown(options = (Date))



@interact(Servers = Server, Dates = Date)

def print_all(Servers, Dates):
    Path ="/home/tim/Bureau/Servers"
    CSV = os.path.join(Path,Servers,Dates,'')
    display(CSV)

    

With jupyter notebook, the result is :

If I change the server, the path change at the same time. Same things for the Dates.

I've 2 questions :

First question :

I've recover the path '/home/tim/Bureau/Servers/Server3/2019-11/'

I would like to add this path to new Dropdown. So I try that :

test3 = widgets.Dropdown(options = (CSV))
display(test3)

But my new dropdown is fill with the litteral path, not with the content of the CSV variable :


Could you show me how to fix it ?

The idea is at the end, I can use the path generate with my dropdown with pd.read_csv to display it to do something like that ( but with only dropdown and the CSV display in add) :

> Interactive Data Analysis with FigureWidget ipywidgets | Python/v3 | Plotly

But with my own CGI.

Second question :

Always with the same idea, I need to use it on my website but I can't install jupyter notebook in my server. So I decide to use embed_minimal_html to create a standalone html page.

So I try to add that at the end of my code :

embed_minimal_html('Page1.html', views=[test, test2], title="TEST")

And the Page1.html is generate with my two dropdowns Server and Dates. But when I try to add the CSV variable in order to have the interatcive display ( display the path and change it with my choice in my dropdown, like with jupyter noteboopk ), I've this error :

[

](Screenshot from 2020-01-30 14-29-32.png - Casimages.com)There is a CSV variable, So why I've this error ? Could you show me how to fix it ?

Please, could you help me ? There are the last two problems that I have !

Thanks ! :slight_smile:

This is an interesting problem.

Is it possible to post your exact HTML (the entire page source code) which is giving you the errors in question 1?

I would like to example the HTML which is causing the funky looking drop down menu.

Thanks.