Problem getting a file pathname with tkFileDialog

Sefyroth cdroulers at hotmail.com
Wed Nov 8 15:01:04 EST 2006


Thanks,

but I get this error when I try this.

UnicodeEncodeError: 'ascii' codec can't encode character u'\xe8' in
position 12: ordinal not in range(128)

 I had encountered it with the askdirectory method as well. Is there an
easy way to bypass this?

Thanks again


Tim Daneliuk wrote:
> cdroulers at hotmail.com wrote:
> > Hello,
> > 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
> >
> > Christian
> >
>
> How about:
>
> print file.name
>
>
>
> --
> ----------------------------------------------------------------------------
> Tim Daneliuk     tundra at tundraware.com
> PGP Key:         http://www.tundraware.com/PGP/




More information about the Python-list mailing list