[module] cygwin directory browser

Anton Vredegoor anton at vredegoor.doge.nl
Tue Jan 22 10:23:04 EST 2002


On Tue, 22 Jan 2002 14:21:35 +1300, "Mark Hadfield"
<m.hadfield at niwa.cri.nz> wrote:

>When I try it I get an exception (traceback below my sig). The file that it
>says is missing...
>
>"/disk0/Program Files/Python/Python22/Tools/idle/Icons/folder.gif"
>
>...is not missing! (BTW this is a Cygwin Unix-style path constructed from
>the Windows path with the substitution "C:\" -> /disk0.)
>
>Do you think it could have a problem with spaces in directory names?

I think that is correct. I have escaped the filenames in the browser
output with backslashes, but I did not think about escaping filenames
for tkinter calling TCl with a pathname with spaces in it for the
icons directory. You should be okay if Idle's on a path without spaces
....

This script was not meant as a final solution but just as a temporary
tool until someone comes up with a real solution, I guess I should
have mentioned that. I think a tool like this should be written using
anygui. 

I have some other options below but I am not sure if they wil work.

>    image = self.geticonimage(imagename)
>  File "/disk0/Program Files/Python/Python22/Tools/idle/TreeWidget.py", line
>86, in geticonimage
>    image = PhotoImage(master=self.canvas, file=fullname)

line 85-86 in TreeWidget :
      fullname = os.path.join(ICONDIR, file + ext)
        image = PhotoImage(master=self.canvas, file=fullname)
  
So maybe this works:

Change line 29 in TreeWidget.py:
    _icondir = os.path.join(os.path.dirname(__file__),
ICONDIR).replace(' ','\ ')

or else changing line 85 may work:
      fullname = os.path.join(ICONDIR, file + ext).replace(' ','\ ')

(watch out for the line wraps)

Please let me know if one of these succeeds. Thanks for your feedback!

Anton.



More information about the Python-list mailing list