Get filename using filefialog.askfilename

Dave Angel davea at davea.name
Wed May 8 18:52:48 EDT 2013


On 05/08/2013 04:14 PM, cheirasacan at gmail.com wrote:
> El martes, 7 de mayo de 2013 23:53:32 UTC+2, Terry Jan Reedy  escribió:
>> On 5/7/2013 4:27 PM, cheirasacan at gmail.com wrote:
>>
>>
>>     <SNIP - a double-spaced google-groups copy of lots of useful advice>
>>>
>
> Yeah. This is an answer. A lot of thanks.
>

For a moment there, I thought you were being sarcastic, and ungrateful 
at that.  But I figured that it must have been my imagination.

Usually, it's better to teach a man to fish, rather than just handing 
him one.  But some would rather just have an answer, but not the 
understanding of how to acquire it.

So, some unsolicited advice.  And mixed in, maybe the actual answer to 
your original question.

1) Lose googlegroups, or figure a way to avoid its bad habits.  Your 
responses here are doublespaced, which makes it hard to read, especially 
when you include so much that has nothing to do with your response. 
Also, triple posting leads to a number of problems, not the least of 
which is the number of other responders who killfile anything from 
googlegroups.  See http://wiki.python.org/moin/GoogleGroupsPython.

2) Include enough of your code that people can actually figure out what 
you're up to.  You're asking a question about a method of an object 
filedialog, but you never show how it's created.

3) Include enough of your error messages or diagnostic prints that we 
can see what's going on.

 > output is: <......name="file.doc"...mode=......encoding..........  >

You elided the only important part of that line, the type of the object 
you're asking about.  Most of us would know that a file object has an 
attribute of name.  But instead I spent quite a while trying to find 
what GUI library you were using that might be handing back something 
representing a file.

4) include the environment you're running in.  In your first thread, you 
included a line:
    Using Windows 7, Python 3.3, sfml 1.3.0 library, ...

Very helpful.  But no such hints here.

5) try not to override builtin names with your own local variables.  In 
this case, you defined a local variable called file, which overwrites, 
presumably by coincidence, its own type name.


Thanks for pointing out the "annotated source code" on fossies.org.  I 
wasn't aware of that location.





-- 
DaveA



More information about the Python-list mailing list