how to open a file by user input in python
<p>I am (trying) to write a tool that will open a file based on user input. 
I want to eventually write the results of the script into a file and store it into the same directory as the input file.</p>

<p>I currently have this</p>

<pre><code>from Bio import SeqIO
import os, glob


var = raw_input("what is the path to the file (you can drag and drop):")
fname=var.rsplit("/")[-1]
fpath = "/".join(var.rsplit("/")[:-1])

os.chdir(fpath)
#print os.getcwd()

#print fname
#for files in glob.glob("*"):
#    print files

with open(fname, "rU") as f:
    for line in f:
        print line
</code></pre>

<p>I do not understand why I cannot open the file. Both the "os.getcwd" and the "glob.glob" part show that I successfully moved to the users directory. In addition, the file is in the correct folder. However, I cannot open the file...
any suggestions would be appreciated </p>
