CostelDum / photograbber

Automatically exported from code.google.com/p/photograbber
Other
0 stars 0 forks source link

Unicode problem with tkDirectoryChooser #92

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
When selecting a file using the File Chooser Dialog, got the following 
exception and the program does nothing.

arl@lap:~/photograbber$ python pg.py 
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.6/lib-tk/Tkinter.py", line 1413, in __call__
    return self.func(*args)
  File "pg.py", line 171, in download
    self.directory = str(tkDirectoryChooser.askdirectory())
  File "/home/arl/photograbber/tkDirectoryChooser.py", line 47, in askdirectory
    return unicode(Chooser(**options).show(), Chooser.encoding)
TypeError: coercing to Unicode: need string or buffer, _tkinter.Tcl_Obj found

My system current version is:

Linux lap 2.6.35-30-generic #61-Ubuntu 2011 x86_64 GNU/Linux
Ubuntu 10.10
Python 2.6.6
python-tk 2.6.6-0ubuntu1

Seems that exception is thrown when trying to convert to unicode in 
tkDirectoryChooser.py line 46.

I temporarily fixed that and got rid of the exception by simply removing the 
unicode call in that line, as showed in the attached diff.

Original issue reported on code.google.com by SniperD...@gmail.com on 6 Nov 2011 at 9:36

Attachments:

GoogleCodeExporter commented 8 years ago
Sorry, seems that I duplicated Issue 56 

http://code.google.com/p/photograbber/issues/detail?id=56

The weird thing is that I don't have non-ASCII characters in my paths.

Original comment by SniperD...@gmail.com on 6 Nov 2011 at 9:39

GoogleCodeExporter commented 8 years ago
You're correct there is a problem there.  I committed the patch from Issue 56 
only to realise that it creates more problems (like the one you were seeing).  
TkInter seems to behave poorly with unicode file paths on Windows.  I'm working 
on switching to WxPython.

I recommend checking out r85 if you're using Linux:

svn checkout -r 85 http://photograbber.googlecode.com/svn/trunk/ 
photograbber-read-only

Original comment by to...@ourbunny.com on 26 Nov 2011 at 7:09