Gheorghe Postelnicu gheorghe.postelnicu at
Wed Nov 8 20:54:53 CET 2006

In our example, try replacing the last line with


---------- Forwarded message ----------
From: cdroulers at
To: python-list at
Date: 8 Nov 2006 11:01:08 -0800
Subject: Problem getting a file pathname with tkFileDialog
I am working on a school project that requires me to get the path of a
filename for future treatment.
I've tried getting a file with tkFileDialog.askopenfile.

import tkFileDialog
file = tkFileDialog.askopenfile()
print file

It prints the opened files stuff, but I just can not find how to get
that path as a string. I've searched around google and the present
group, and found no documentation on the file class used with
tkFileDialog. Does someone have a solution for that?

Thank you


Gheorghe Postelnicu, PhD
MGH, Harvard Medical School

More information about the Python-list mailing list