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

Fatal Python error: Py_Initialize: can't initialize sys #7

Closed
ljgabc opened this issue May 4, 2015 · 5 comments
Closed

Fatal Python error: Py_Initialize: can't initialize sys #7

ljgabc opened this issue May 4, 2015 · 5 comments

Comments

@ljgabc
Copy link

ljgabc commented May 4, 2015

Hi, I build Python-3.4.2 follow the build.sh, but run failed.

python python3.4.2
android 4.4.3

export PYTHONHOME=/data/Python-3.4.2

/data/Python-3.4.2/bin/python3

Fatal Python error: Py_Initialize: can't initialize sys
sys.excepthook is missing
object : ValueError('character U+7461642f is not in range [U+0000; U+10ffff]',)
type : ValueError
refcount: 1
address : 0x76cf7660
lost sys.stderr
[1] + Stopped (signal) python

@shizmob
Copy link
Member

shizmob commented May 5, 2015

Hi!

It seems like it’s encountering some invalid bytestream very early on in the sys module initialisation, possibly related to an invalid filesystem path.
Judging from this code it could be a lot of things, but I suspect it’s one of the statements that start from here that causes the error.

Could I possibly get the output of running env in your Android shell, and would it be possible for you to hook up gdb to it and get a backtrace of the crash?
Alternatively, running arm-none-eabi-addr2line -e build/*/bin/python3 0x76cf7660 on the build computer could also help a lot to help me figure out where exactly the crash occurred.

Thanks!

@ljgabc
Copy link
Author

ljgabc commented Jun 9, 2015

Hi,
I recompiled the source and now it runs successfully on my board, so I cannot get the detail information again. Maybe it's my own mistake. Sorry for this, I'll close this issue.

@ljgabc ljgabc closed this as completed Jun 9, 2015
@shizmob
Copy link
Member

shizmob commented Jun 9, 2015

Glad it worked out, don't be afraid to re-open if the issue pops up again. :)

@michalliu
Copy link

michalliu commented Jun 10, 2016

1705     SET_SYS_FROM_STRING("executable",
1706                         PyUnicode_FromWideChar(
1707                                Py_GetProgramFullPath(), -1));
1708     SET_SYS_FROM_STRING("prefix",
1709                         PyUnicode_FromWideChar(Py_GetPrefix(), -1));
1710     SET_SYS_FROM_STRING("exec_prefix",
1711                         PyUnicode_FromWideChar(Py_GetExecPrefix(), -1));
1712     SET_SYS_FROM_STRING("base_prefix",
1713                         PyUnicode_FromWideChar(Py_GetPrefix(), -1));

It crashed at 1705. My error message is same as @ljgabc 's. It will happen once you set the PYTHONHOME environment variable.

@shizmob
Copy link
Member

shizmob commented Jun 18, 2016

Does this also occur with @yan12125's fork? I haven't looked into this for a while, honestly. If it does, I'll be sure to check out the cause!

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

3 participants