[TxMt] dialog.py UTF-8 problem

Hans-Joerg Bibiko bibiko at eva.mpg.de
Fri May 30 07:02:40 UTC 2008


On 30 May 2008, at 04:58, Alex Ross wrote:
>> ...
>> suggestions = list(list(unicode(grepout.read(), "UTF-8"))[2:])
>> ...
> Just a tip here...
>
> a_list[2:]  returns a list, so the second list call is redundant.
Thanks. I've already mentioned, I'm just learning python, but I  
thought: make assurance double sure. ;)


>> suggestions contains a list of Unicode characters. Fine.
>> suggestions[3] etc. can I insert in TM's document perfectly.
>>
>> But:
>>
>> result = dialog.menu(suggestions)
>>
>> fails.
>>
> dialog.py didn't support unicode.  I have made a couple changes that  
> I think should fix you're problem.  Let me know if it works now!

Now it works brilliant. Thanks a lot. Yesterday I wrote my own routine  
to call tm_dialog directly, but now the code looks much more elegant :)

But one tiny thing I found in dialog.py line 14:
dialog = os.path.join(support, 'bin/tm_dialog')

You bound it directly. I would suggest to use
dialog = os.environ["DIALOG"]
caused by the issue that we have DIALOG1 (tm_dialog) and DIALOG2  
(tm_dialog2). If one calls DIALOG2 with the 'old' argument structure  
it switches automatically to DIALOG1. By doing so, I mean, the script  
is more flexible.


Once again thanks,

--Hans



More information about the textmate mailing list