Quantcast
Channel: ActiveState Community Site - ActivePython discussion
Viewing all articles
Browse latest Browse all 75

UnicodeDecodeError: I almost fix it...

$
0
0

Hy, i have a problem, when i go profiling python scipt im getting this error:

self._socket.send(_encode_response(response))
  File "F:\Programi (INSTALIRANI)\Komodo IDE\lib\support\dbgp\pythonlib\dbgp\client.py", line 128,in _encode_response
    return packet.encode()
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 266: ordinal not in range(128)

Lets check where the problem is ... (client.py line 128):

def _encode_response(response):
    # response is already utf-8-encoded
    packet ='%d\0%s\0' % (len(response), response)
    return packet.encode()

The problem is in response variable... when i print this variable i get this string:

<?xml version="1.0" encoding="utf-8"?>
<init  parent="" session="R1lyeZQaTt2OvULCmh1k8A==" fileuri="file:///C:/Text-1.py" xmlns="urn:debugger_protocol_v1"thread="__main__ 3948" language="python" hostname="Uros-PC" appid="3672" protocol_version="1.0" idekey="Uroš"type="code_profiling"/>

Beacuse im from Slovenia my language have this letters in my alphabet:[Š,?,Ž]
Hostname variable was at the begining "Uroš-PC", this was easy fix: Changing name of my computer.

******************************************************************
The last fix i need is changing the idekey. Could pls someone tell me what i must to do to change idekey from "Uroš" to "Uros".
******************************************************************

I past picture that showing what is happening in client.py line 128:

AttachmentSize
Problem.PNG59.3 KB

Viewing all articles
Browse latest Browse all 75

Trending Articles