Closed ghost closed 3 years ago
It looks like you've generated a ValueError in your code, but you haven't initialised the python runtime to handle that error. It's not at all clear why this is being reported as an error in the Python Apple Runtime, as you haven't provided any detail about what you have done to generate this error.
Closing this ticket as there is insufficient detail to provide any meaningful response.
NSString tmp_path; NSString python_home; wchar_t *wpython_home;
NSString * resourcePath = [[NSBundle mainBundle] resourcePath];
// Special environment to prefer .pyo; also, don't write bytecode
// because the process will not have write permissions on the device.
putenv("PYTHONOPTIMIZE=");
putenv("PYTHONDONTWRITEBYTECODE=1");
python_home = [NSString stringWithFormat:@"%@/Python.framework/Resources", resourcePath, nil];
NSLog(@"PythonHome is: %@", python_home);
wpython_home = [python_home UTF8String];
Py_SetPythonHome(wpython_home);
// iOS provides a specific directory for temp files.
tmp_path = [NSString stringWithFormat:@"TMP=%@/tmp", resourcePath, nil];
putenv((char *)[tmp_path UTF8String]);
NSLog(@"Initializing Python runtime");
Py_Initialize();
this is my code
i don't run same code ,only invoke Py_Initialize
Python.framework
What I have downloaded is not a framework
@cxymq Yes... and? Where were you promised Python-support-package was packaged as a framework?
@freakboy3742 I have the same problem with @cxymq , i cant just copy the resources folder into bundle so how can i config pythonhomepath?
@GuFangRen If you want to see an example of this package being used, take a look at Briefcase. This support package primarily exists as a utility to be used by briefcase, which will generate a functioning Xcode project that embeds the Python interpreter.
Initializing Python runtime Fatal Python error: Py_Initialize: can't initialize sys sys.excepthook is missing object : ValueError('character U+6972702f is not in range [U+0000; U+10ffff]',) type : ValueError refcount: 1 address : 0x28123c5b8 lost sys.stderr