I am trying to deploy my app on streamlit cloud, and I am having a problem with paths.
Here is my repo https://github.com/SaidMANAM/Application-IA-scoring_CREDIT
Thanks in advance for the help !
I am trying to deploy my app on streamlit cloud, and I am having a problem with paths.
Here is my repo https://github.com/SaidMANAM/Application-IA-scoring_CREDIT
Thanks in advance for the help !
Hi @SaidMANAM, welcome to the Streamlit community!
It’s important to note that absolute paths to your local computer directory mapping is unlikely to work on another computer, irrespective of using Streamlit Cloud or another hosting service. You need to use relative references to the files for your code to work.
Best,
Randy
When you open a file with the name “filename.ext”; you are telling the open() function that your file is in the current working directory . This is called a relative path.
file = open('filename.ext') //relative path
In the above code, you are not giving the full path to a file to the open() function, just its name - a relative path. The error “FileNotFoundError: [Errno 2] No such file or directory” is telling you that there is no file of that name in the working directory. So, try using the exact, or absolute path.
file = open(r'C:\path\to\your\filename.ext') //absolute path
In the above code, all of the information needed to locate the file is contained in the path string - absolute path.
If the user does not pass the full path to the file (on Unix type systems this means a path that starts with a slash), the python file path is interpreted relatively to the current working directory. The current working directory usually is the directory in which you started the program. In order to make this work, the directory containing the python executable must be in the PATH, a so-called environment variable that contains directories that are automatically used for searching executables when you enter a command. In any case, if your Python script file and your data input file are not in the same directory, you always have to specify either a relative path between them or you have to use an absolute path for one of them.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.