Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialSiddharth Kulkarni
49 PointsHow can I download an output of a Python file inside a container to my host machine's dedicated folder?
I have a Python file that 1. Scrapes data of a web page 2. Formats the data into a pandas data-frame 3. downloads the data as an xls file in the folder C:/Sid. I have this Python script inside a container but when I run the container I cannot see a file created as Sid.xls in C:/Sid. I tried the following command docker run - v C:/Sid/: /EIA imagename but its not working.
1 Answer
adrian miranda
13,561 PointsThis is a somewhat difficult question, which can be solved in a variety of ways. The first, which I think you understand already, is that we do not usually want to store out output in a container, because it is likely to go away and be lost when the container is shut down. The usual solution is to have the program actually store the data somewhere else, or move it somewhere else after creating it. A very simple example might be to have your program, when it is done creating an output file, then have it use ftp to an ftp server somewhere. (in python you can use ftplib). Or you might send the output to a web server that permits uploading files. Or connect to a database server and send the data as you retrieve it. All of these will require some work, and creating some place to send the data.