2012-01-25 60 views
1

我運行sparql查詢人名從dbpedia給電影 獲取數據後我也顯示名稱因爲投入的Mysql 我得到正常的名稱,但在一個pointit拋出錯誤python錯誤codecs.charmap_encode(輸入,錯誤,encoding_map)UnicodeEncodeError:'charmap'編解碼器不能編碼字符

我得到了一個錯誤:

Traceback (most recent call last): 
    File "TestSparql.py", line 172, in <module> 
    print person_Name 
    File "C:\Python27\Lib\encodings\cp437.py", line 12, in encode 
    return codecs.charmap_encode(input,errors,encoding_map) 
UnicodeEncodeError: 'charmap' codec can't encode characters in position 16-21: character maps to <undefined> 

可能有人解釋這是什麼錯誤的手段和爲什麼它可能已經來了嗎?

+1

你可能會發現這個其他線程有幫助 http://stackoverflow.com/questions/3695567/unicodeencodeerror-when-fetching-urls – Lex

回答

0

該錯誤意味着Python無法將Unicode字符串編碼爲unicode。在http://wiki.python.org/moin/UnicodeEncodeError

爲了幫助您進一步的細節,很多細節被遺漏:

  • 您使用查詢DBpedia中
  • 產生這樣的錯誤
  • 一些環境的詳細信息打印代碼SPARQL Python實現(你的字符集配置等)
相關問題