[Tutor] Unusual pathfile

Steven D'Aprano steve at pearwood.info
Tue Sep 13 20:20:40 CEST 2011


Susana Iraiis Delgado Rodriguez wrote:
> I think I've received many complains for my questions and messages

Please don't be upset! We're not angry at your, and we are trying to 
help you.

In English, we have a saying:

"Give a man a fish, and you feed him for one day. Teach a man how to 
catch fish, and you feed him forever."

We are happy to help solve your problems, but just as important is to 
teach you how to solve your problems without our help.

Also, sometimes your questions are too hard for us to answer without 
spending many hours of work. We are volunteers who do this for free. We 
are not being paid for this. We do this as a way to pay back to the 
community that helped us when we were beginners. But help has to go both 
ways: you help us by asking good questions, and we help you by teaching 
you the answers.

Lastly, remember that some of us use Apple Macs, or Linux, and do not 
have Windows. If this problem is specific to Windows pathnames, it might 
be impossible for us to help except by guessing. So have patience that 
we can't solve everything easily.


Let us start with a simple part: you have this function:

from Tkinter import *
root = Tk()
import tkFileDialog
dir = ""

def directorio():
     global dir
     print 'Seleccione directorio donde empezar'
     dirname1 = tkFileDialog.askdirectory(
         parent=root, initialdir="/",
         title='Selecciona la ruta a escanear'
         )
     if len(dirname1 ) > 0:
         print "You chose %s" % dirname1
     dir = dirname1


If I run this function, I get this:

 >>> directorio()
Seleccione directorio donde empezar
You chose /usr/bin


(I am using Linux, so I have no C: drive.)

What do you get if you run it?



-- 
Steven


More information about the Tutor mailing list