0

I am trying to make a streamlit dashboard but just to get started, I am trying to import my csv file with data. I added the csv file into the file in which I am working with on vscode which is pictured. I also coppied the path of the csv file which is

"C:\Users\solim\AppData\Roaming\.anaconda\navigator\.anaconda\navigator\scripts\FinalProject\survey.csv" 

this path matches up to the path of where my python code is that I run for streamlit but once again it keeps saying that the file cannot be found even though it is exactly where my python code is I just do not understand and it is very frustrating.

Error when I run:

Error when I run



Proof that the file name is spelled correct and the file is in my folder:

Proof

I am expecting the file data to be printed on my streamlit page.

ScottC
  • 3,941
  • 1
  • 6
  • 20
Dawn
  • 1
  • Does the `survey.csv` file appear when you `import os; print(os.listdir(os.curdir))` – ScottC Dec 21 '22 at 23:54
  • where should i insert the file name into print(os.listdir(os.curdir))? – Dawn Dec 22 '22 at 00:39
  • When you print the contents of the current directory, you should see the file name listed. You do not need to insert the file name anywhere. This is just a check to see what your program believes to be the current working directory, and whether your file is located in that directory. – ScottC Dec 22 '22 at 01:05
  • @ScottC oh ok thank you for the response, when I printed, this is what it shows ['mental.py', 'survey.csv', 'survey.xls'], so that means the file is in the directory, why is it still not found? – Dawn Dec 22 '22 at 01:07
  • @ScottC do you know the syntax for printing the absolute path with the file name to pd.read_csv() ? – Dawn Dec 22 '22 at 01:32
  • This is probably what you are looking for: https://stackoverflow.com/questions/3430372/how-do-i-get-the-full-path-of-the-current-files-directory – ScottC Dec 22 '22 at 01:39
  • the path of the csv file and the python file are the same so I am still confused why the file is not found, very frustrating and confusinng – Dawn Dec 22 '22 at 02:00
  • I think it may have something to do with how you are running the streamlit app: This may help: https://awesome-streamlit.readthedocs.io/en/latest/vscode.html#running-your-streamlit-app – ScottC Dec 22 '22 at 02:43
  • And this may also help: https://medium.com/geekculture/how-to-run-your-streamlit-apps-in-vscode-3417da669fc – ScottC Dec 22 '22 at 02:45
  • @ScottC thank you so much, the second link helped – Dawn Dec 23 '22 at 21:29

1 Answers1

0

screenshot of launch.json code Enter "args": ["run", "${file}"] into j.son file

Follow the steps from this tutorial to get to launch.json. After, the file should be found

Dawn
  • 1