简体   繁体   中英

UnicodeDecodeError: 'ascii' codec can't decode byte 0xbe in position 1

I'm getting error when I try to run file in cmd. When I run it in eclipse it works. Can't figure out where is the problem.. Eill you give me an advice?

getConnection
__init__
initialize
Traceback (most recent call last):
  File "D:\workspace\AproximateSearchPython2\Search.py", line 60, in <module>
    main()
  File "D:\workspace\AproximateSearchPython2\Search.py", line 57, in main
    search("weight")
  File "D:\workspace\AproximateSearchPython2\Search.py", line 24, in search
    levenshteinResults=SC.findMatchesByLevenshteinDistance(pattern) # Pre vstupy do 12 znakov
  File "D:\workspace\AproximateSearchPython2\SearchClass.py", line 39, in findMatchesByLevenshteinDistance
    levResults=list(automata.find_all_matches(pattern, k, matcher))
  File "D:\workspace\AproximateSearchPython2\automata.py", line 182, in find_all_matches
    next = lookup_func(match)
  File "D:\workspace\AproximateSearchPython2\automata.py", line 203, in __call__
    pos = bisect.bisect_left(self.l, w)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xbe in position 1: ordinal not in range(128)

您需要将字符串编码为utf-8,例如:

u'my non ascii str'.encode('utf-8')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM