[PyQt] pyqtdeployed app crashes android but not iOS

Phil Thompson phil at riverbankcomputing.com
Fri Feb 27 17:36:01 GMT 2015

On 06/02/2015 3:19 pm, lloyd konneker wrote:
> (This post is out of order:  I sent it to the wrong list.  See my
> earlier post for a workaround for the problem which this post
> describes.)
> I have determined that it fails here in pythonrun.c in function 
> initstdio():
>     fd = fileno(stdin);
>     /* Under some conditions stdin, stdout and stderr may not be 
> connected
>      * and fileno() may point to an invalid file descriptor. For 
> example
>      * GUI apps don't have valid standard streams by default.
>      */
>     if (!is_valid_fd(fd)) {
>         std = Py_None;
>         Py_INCREF(std);
>     }
>     else {
>        std = create_stdio(iomod, fd, 0, "<stdin>", encoding, errors);
>        if (std == NULL) {  << this is true and it proceeds to return
> an error and abort
> I haven’t determined yet why create_stdio fails, or why fileno(stdin)
> returns a valid fd if there is no stdin for the process on Android?
> I don’t understand the rationale here: why every process should have a
> stdin and why the Python interpreter needs to initialize it
> (especially on Android with PyQt.)
> One comment in the discussion of Python issue 17797 says a workaround
> is to redirect stdio to a file before calling Py_InitializeEx (and
> thus initstdio() )
> Note that issue 17797 has recent comments in the last few days.  The
> thread says any ‘fix’ for Python (at least in regards Windows VS11 as
> a culprit) must wait till Python3.5.  The pertinent code in Python
> seems to have been changed recently.

Sorry for not responding sooner...

Is there any update on this?

Is it only a problem when running on real devices, or does it happen 
running on the emulator as well?


More information about the PyQt mailing list