0

I have created a small tool using Tkinter that enters a string using entry widget , search for that string in multiple files and displays the list of file names that contains that string in listbox. All the files are utf-8 encoded already. Now the problem is, when I run my code from IDE(Pycharm), and input search string that contains a utf-8 character in the tool UI, it works fine and searched all files that contains it.

But if I create a exe file of that code(using py2exe), and launch the tool , enter the same string, it cannot search and code continues to search non-stop.(With non- utf-8 characters, it works fine)

In the application code, I have 'imported codecs' and opened file using command codecs.open(SourceFile, encoding ='utf-8')

Please help me to solve this problem that how exe file can also work correct and search strings successfully.

Priyanka
  • 1
  • 1
  • Try to add this line to your code [import unicode_literals](https://stackoverflow.com/questions/809796/any-gotchas-using-unicode-literals-in-python-2-6) – khelili miliana Jun 13 '17 at 09:30
  • I tried as you suggested, but seems it cannot find unicode_literals, and shows error. – Priyanka Jun 13 '17 at 10:53
  • Did you follow the link to find out that the full statement is `from __future__ import unicode_literals`? – lenz Jun 13 '17 at 13:52
  • Yes, I used the same statement as you mentioned..but it didn't solve my problem still. – Priyanka Jun 14 '17 at 03:38

0 Answers0