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

TypeError: must be string without null bytes, not str #1505

Closed
Dreamtale opened this issue Jul 8, 2018 · 4 comments
Closed

TypeError: must be string without null bytes, not str #1505

Dreamtale opened this issue Jul 8, 2018 · 4 comments

Comments

@Dreamtale
Copy link

`Sun Jul 8 17:33:40 2018
Unknown platform.
Ren'Py 7.0.0.196

Bootstrap to the start of init.init took 0.00s
Bootstrap to the start of init.init took 0.00s
Manufacturer samsung model SM-N920C
Screen diagonal is 5.24501707162 inches.
Early init took 0.11s
Early init took 0.11s
Loader init took 0.05s
Loader init took 0.05s
Loading error handling took 2.74s
Loading error handling took 2.74s
Loading script took 30.76s
Loading script took 30.76s
Saving to /storage/emulated/0/Android/data/su.sovietgames.everlastingsummer/files/saves
Loading save slot metadata. took 0.01s
Loading save slot metadata. took 0.01s
Loading persistent took 0.00s
Loading persistent took 0.00s
Importing _renpysteam: ImportError('No module named _renpysteam',)
Set script version to: (7, 0, 0)

Traceback (most recent call last):
File "main.py", line 198, in
main()
File "main.py", line 195, in main
renpy.bootstrap.bootstrap(renpy_base)
File "/data/user/0/su.sovietgames.everlastingsummer/files/renpy/bootstrap.py", line 333, in bootstrap
renpy.error.report_exception(e)
File "/data/user/0/su.sovietgames.everlastingsummer/files/renpy/error.py", line 211, in report_exception
sys.stdout.write(full.getvalue())
File "/data/user/0/su.sovietgames.everlastingsummer/files/renpy/log.py", line 227, in write
self.real_file.write(es) #
File "", line 19, in write
TypeError: must be string without null bytes, not str
`

@Dreamtale
Copy link
Author

Well I did some workaround in log.py:

        try:
            self.real_file.write(es)
            self.real_file.flush()
        except:
            self.real_file.write("WARNING: ERROR WRITING TO FILE!")
            self.real_file.flush()

@Uzume
Copy link

Uzume commented Jul 8, 2018

@Dreamtale Рита Тайнакова, that error comes from here:

  • https://github.com/python/cpython/blob/2.7/Python/getargs.c#L925
    However, I am not exactly sure what is causing it (clearly some sort of encoding issue). I am guessing you have issues in a .rpy that has a Russian filename? The traceback is probably trying to print the filename but does not know which encoding the filesystem is in (and is incorrectly guessing UTF-8).

Here are some similar issues:

You might get more useful information in your workaround with code like:

        try:
            self.real_file.write(es)
            self.real_file.flush()
        except:
            self.real_file.write("WARNING: ERROR WRITING TO FILE!\n{0}".format(es.replace('\0', '')))
            self.real_file.flush()

renpytom added a commit to renpy/rapt that referenced this issue Jul 8, 2018
renpytom added a commit to renpy/rapt that referenced this issue Jul 8, 2018
@renpytom
Copy link
Member

renpytom commented Jul 8, 2018

This looks like it was being caused in the android code, so I fixed it there. It still is a bad idea to try and print null bytes to standard out, but now the android support will print them as \0 rather than crashing.

@renpytom renpytom closed this as completed Jul 8, 2018
@huntertritter
Copy link

This needs fixing cause i can't find a Solution to this Line in the Code. If One of
you guys help, i'd really appreciate it.

This is the Code.
subObject: Traceback (most recent call last):
File "C:\noesisv4395\plugins\python\fmt_DBL.py", line 32, in LoadModel
readObject(bs)
File "C:\noesisv4395\plugins\python\fmt_DBL.py", line 137, in readObject
print("subObject:",name, info, bs.getOffset())
TypeError: must be str without null bytes, not str
fmt_DBL.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants