reloadware / reloadium

Hot Reloading and Profiling for Python
https://reloadium.io
Apache License 2.0
2.74k stars 56 forks source link

Reloadium experienced a fatal error and has to quit. #151

Closed gengchaogit closed 12 months ago

gengchaogit commented 1 year ago

Describe the bug*

A clear and concise description of what the bug is. C:\Users\test\Documents\python_code\gitlab_code\venv\Scripts\python.exe" -m reloadium_launcher pydev_proxy "C:/Program Files/JetBrains/PyCharm Community Edition 2022.1/plugins/python-ce/helpers/pydev/pydevd.py" --multiprocess --client 127.0.0.1 --port 50448 --file "C:\Users\test\Documents\python_code\gitlab_code\test\Main.py" Connected to pydev debugger (build 231.9011.38) ■■■■■■■■■■■■■■■ Reloadium 1.1.1 ■■■■■■■■■■■■■■■ If you like this project consider becoming a sponsor or giving a star at https://github.com/reloadware/reloadium Reloadium experienced a fatal error and has to quit. Please submit a github issue to let us know at https://github.com/reloadware/reloadium

Process finished with exit code 1

image image

python environment Python 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022, 23:13:41) [MSC v.1929 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.

but i can esay to use in another test project like this

image image
gengchaogit commented 1 year ago

The first Main.py is startup python file for a big project

gengchaogit commented 1 year ago

How can I print more information to determine what the cause is?

dkrystki commented 1 year ago

@gengchaogit It should be RW_DEBUG=True not TRUE.

gengchaogit commented 1 year ago

Oh,Thanks! here is the debug log.....

■■■■■■■■■■■■■■■ Reloadium 1.1.1 ■■■■■■■■■■■■■■■ If you like this project consider becoming a sponsor or giving a star at https://github.com/reloadware/reloadium Traceback (most recent call last): File "C:\Users\test.reloadium\package\3.10\reloadium\corium\ll1llll11111llllIl1l1.py", line 169, in l1lll11ll1ll111lIl1l1 File "D:\a\reloadware\reloadware\reload\package__obfuscated__\reloadium\fast\lll1111l111l11llIl1l1.py", line 81, in exec_module File "D:\a\reloadware\reloadware\reload\package__obfuscated\reloadium\fast\l1ll1l1111l1ll1lIl1l1\l11ll11ll11l1l1lIl1l1.py", line 561, in ll1l11lllll111l1Il1l1 File "D:\a\reloadware\reloadware\reload\package\obfuscated__\reloadium\fast\l1ll1l1111l1ll1lIl1l1\l11ll11ll11l1l1lIl1l1.py", line 583, in lllllllllllll111Il1l1 File "C:\Users\test.reloadium\package\3.10\reloadium\corium\l11ll1l1l1lll111Il1l1.py", line 27, in l1llll111ll11l1lIl1l1 File "C:\Program Files\Python\lib\pathlib.py", line 1133, in read_text return f.read() File "C:\Program Files\Python\lib\codecs.py", line 322, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa3 in position 5719: invalid start byte Reloadium experienced a fatal error and has to quit. Please submit a github issue to let us know at https://github.com/reloadware/reloadium

Process finished with exit code 1

gengchaogit commented 1 year ago

In fact, I did not report any errors when using the debug feature that comes with pycharm

gengchaogit commented 1 year ago

the full path like that C:\Users\test\OneDrive - Company\Documents\python_code\gitlab_code

Tt's that OneDrive - Company issue? The path contains space.

gengchaogit commented 1 year ago

Tested, not the space issue.

gengchaogit commented 1 year ago

Debug to here

image image

next will show error

image

the data print below

Add attributes to simplify introspection

sr.data_encoding = data_encoding
sr.file_encoding = file_encoding
return sr

Helpers for codec lookup

def getencoder(encoding):

""" Lookup up the codec for the given encoding and return
    its encoder function.

    Raises a LookupError in case the encoding cannot be found.

"""
return lookup(encoding).encode

def getdecoder(encoding):

""" Lookup up the codec for the given encoding and return
    its decoder function.

    Raises a LookupError in case the encoding cannot be found.

"""
return lookup(encoding).decode

def getincrementalencoder(encoding):

""" Lookup up the codec for the given encoding and return
    its IncrementalEncoder class or factory function.

    Raises a LookupError in case the encoding cannot be found
    or the codecs doesn't provide an incremental encoder.

"""
encoder = lookup(encoding).incrementalencoder
if encoder is None:
    raise LookupError(encoding)
return encoder

def getincrementaldecoder(encoding):

""" Lookup up the codec for the given encoding and return
    its IncrementalDecoder class or factory function.

    Raises a LookupError in case the encoding cannot be found
    or the codecs doesn't provide an incremental decoder.

"""
decoder = lookup(encoding).incrementaldecoder
if decoder is None:
    raise LookupError(encoding)
return decoder

def getreader(encoding):

""" Lookup up the codec for the given encoding and return
    its StreamReader class or factory function.

    Raises a LookupError in case the encoding cannot be found.

"""
return lookup(encoding).streamreader

def getwriter(encoding):

""" Lookup up the codec for the given encoding and return
    its StreamWriter class or factory function.

    Raises a LookupError in case the encoding cannot be found.

"""
return lookup(encoding).streamwriter

def iterencode(iterator, encoding, errors='strict', **kwargs): """ Encoding iterator.

Encodes the input strings from the iterator using an IncrementalEncoder.

errors and kwargs are passed through to the IncrementalEncoder
constructor.
"""
encoder = getincrementalencoder(encoding)(errors, **kwargs)
for input in iterator:
    output = encoder.encode(input)
    if output:
        yield output
output = encoder.encode("", True)
if output:
    yield output

def iterdecode(iterator, encoding, errors='strict', **kwargs): """ Decoding iterator.

Decodes the input strings from the iterator using an IncrementalDecoder.

errors and kwargs are passed through to the IncrementalDecoder
constructor.
"""
decoder = getincrementaldecoder(encoding)(errors, **kwargs)
for input in iterator:
    output = decoder.decode(input)
    if output:
        yield output
output = decoder.decode(b"", True)
if output:
    yield output

Helpers for charmap-based codecs

def make_identity_dict(rng):

""" make_identity_dict(rng) -> dict

    Return a dictionary where elements of the rng sequence are
    mapped to themselves.

"""
return {i:i for i in rng}

def make_encoding_map(decoding_map):

""" Creates an encoding map from a decoding map.

    If a target mapping in the decoding map occurs multiple
    times, then that target is mapped to None (undefined mapping),
    causing an exception when encountered by the charmap codec
    during translation.

    One example where this happens is cp875.py which decodes
    multiple character to \\u001a.

"""
m = {}
for k,v in decoding_map.items():
    if not v in m:
        m[v] = k
    else:
        m[v] = None
return m

error handlers

try: strict_errors = lookup_error("strict") ignore_errors = lookup_error("ignore") replace_errors = lookup_error("replace") xmlcharrefreplace_errors = lookup_error("xmlcharrefreplace") backslashreplace_errors = lookup_error("backslashreplace") namereplace_errors = lookup_error("namereplace") except LookupError:

In --disable-unicode builds, these error handler are missing

strict_errors = None
ignore_errors = None
replace_errors = None
xmlcharrefreplace_errors = None
backslashreplace_errors = None
namereplace_errors = None

Tell modulefinder that using codecs probably needs the encodings

package

_false = 0 if _false: import encodings

Tests

if name == 'main':

# Make stdout translate Latin-1 output into UTF-8 output
sys.stdout = EncodedFile(sys.stdout, 'latin-1', 'utf-8')

# Have stdin translate Latin-1 input into UTF-8 input
sys.stdin = EncodedFile(sys.stdin, 'utf-8', 'latin-1')
dkrystki commented 1 year ago

It seems like your file is under different than utf-8 encoding. Could you please check what encoding is used for the file that fails?

dkrystki commented 12 months ago

Fixed in Reloadium 1.2.0 and PyCharm plugin 1.2.0

gengchaogit commented 12 months ago

oh, thanks!