How do I allow a user to select a file?

python, r

Solution

One option I found after a quick google (`python open directory dialog box`) is to use `TKinter`:

import Tkinter, tkFileDialog
root = Tkinter.Tk()
dirname = tkFileDialog.askdirectory(parent=root, initialdir="/",
                                    title='Please select a directory')

I found the information here.

Problem

Right now, I have this line in my code to hard-code the directory path ``` dir_path = '/home/user/pywork' ``` but I would rather let the user select it herself using a construct similar to R's `scan(choose.files())`. How do I go about it? Thanks,

Original source