chriskiehl / Gooey

Turn (almost) any Python command line program into a full GUI application with one line
MIT License
20.66k stars 1.02k forks source link

Gooey application hangs up during task execution because of an UnicodeDecodeError #852

Open ragdollfun opened 2 years ago

ragdollfun commented 2 years ago

Hello everyone,

I'm unable to turn my cli python script the way it is described in the readme:

from gooey import Gooey

@Gooey      <--- all it takes! :)
def main():
  parser = ArgumentParser(...)
  # rest of code

I get a first window: image but after I press start, the location of my script is printed out and nothing else happens. Even the stop button is unresponsive. I was expecting it to start printing out the same text that I see when I run my script in cli mode.

But since I launch my application from the console, I can see the following error popping out when I press start in the gui:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "...\Miniconda3\envs\analyse\lib\threading.py", line 980, in _bootstrap_inner
    self.run()
  File "...\Miniconda3\envs\analyse\lib\threading.py", line 917, in run
    self._target(*self._args, **self._kwargs)
  File "...\Miniconda3\envs\analyse\lib\site-packages\gooey\gui\processor.py", line 70, in _forward_stdout
    _progress = self._extract_progress(line)
  File "...\Miniconda3\envs\analyse\lib\site-packages\gooey\gui\processor.py", line 84, in _extract_progress
    find = partial(re.search, string=text.strip().decode(self.encoding))
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x82 in position 10: invalid start byte

OS is Windows 10 Python version: 3.9.13 (installed through Miniconda) Gooey version: 1.0.8.1 (installed from the conda-forge repo)

Thank you in advance !

P.S. I found the posts mentioning similar issues: https://github.com/chriskiehl/Gooey/issues/438 https://github.com/chriskiehl/Gooey/issues/520 but I'm not sure if they are at all related to mine since I'm not using PyInstaller

linroex commented 1 year ago

try to use PYTHONUTF8 mode? I set PYTHONUTF8=1 and problem solved