Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Encoding Non-Unicode Prompt Characters #23

Open
guumaster opened this issue Sep 4, 2022 · 1 comment
Open

[Bug] Encoding Non-Unicode Prompt Characters #23

guumaster opened this issue Sep 4, 2022 · 1 comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@guumaster
Copy link

If you this in the prompt: "in the style of zdzisław beksiński" it makes the plugin fail with this error:

UnicodeEncodeError
Python 3.8.1: D:\Program Files\Krita (x64)\bin\krita.exe
Sun Sep  4 13:54:27 2022

A problem occurred in a Python script.  Here is the sequence of
function calls leading up to the error, in the order they occurred.

 C:\Users\MY_USER\AppData\Roaming\krita\pykrita\koi\koi.py in pingServer(self=<koi.koi.Koi object>)
  121 
  122         # wait for response and read image
  123         with request.urlopen(r, timeout=60) as response:
  124             returned_image = QImage.fromData(response.read())
  125 
global request = <module 'urllib.request' from 'D:\\Program Files...x64)\\python\\python38.zip\\urllib\\request.pyc'>
request.urlopen = <function urlopen>
r = <urllib.request.Request object>
timeout undefined
response undefined

 d:\Program Files\Krita (x64)\urllib\request.py in urlopen(url=<urllib.request.Request object>, data=None, timeout=60, cafile=None, capath=None, cadefault=False, context=None)

...
UnicodeEncodeError: 'latin-1' codec can't encode character '\u0142' in position 78: ordinal not in range(256)
    __cause__ = None
    __class__ = <class 'UnicodeEncodeError'>
    __context__ = None
    __delattr__ = <method-wrapper '__delattr__' of UnicodeEncodeError object>
....
    __suppress_context__ = False
    __traceback__ = <traceback object>
    args = ('latin-1', 'a powerful wizard; cracked open sphere; glowing ...painting; magic the gathering art; fine detailed;', 78, 79, 'ordinal not in range(256)')
    encoding = 'latin-1'
    end = 79
    object = 'a powerful wizard; cracked open sphere; glowing ...painting; magic the gathering art; fine detailed;'
    reason = 'ordinal not in range(256)'
    start = 78
    with_traceback = <built-in method with_traceback of UnicodeEncodeError object>

The above is a description of an error in a Python program.  Here is
the original traceback:

Traceback (most recent call last):
  File "C:\Users\MY_USER\AppData\Roaming\krita\pykrita\koi\koi.py", line 123, in pingServer
    with request.urlopen(r, timeout=60) as response:
  File "urllib\request.py", line 222, in urlopen
  File "urllib\request.py", line 525, in open
  File "urllib\request.py", line 542, in _open
  File "urllib\request.py", line 502, in _call_chain
  File "urllib\request.py", line 1348, in http_open
  File "urllib\request.py", line 1319, in do_open
  File "http\client.py", line 1230, in request
  File "http\client.py", line 1271, in _send_request
  File "http\client.py", line 1203, in putheader
UnicodeEncodeError: 'latin-1' codec can't encode character '\u0142' in position 78: ordinal not in range(256)

@nousr
Copy link
Owner

nousr commented Sep 4, 2022

thanks for making me aware of this--i'll have to see if there's a way to fix this issue--if not i'll just need to make an error dialogue for it.

@nousr nousr added bug Something isn't working help wanted Extra attention is needed good first issue Good for newcomers labels Sep 4, 2022
@nousr nousr pinned this issue Sep 4, 2022
@nousr nousr changed the title prompt encoding error [Bug] Encoding Non-Unicode Prompt Characters Sep 4, 2022
@nousr nousr unpinned this issue Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants