Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix platform fail on p4a #694

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

Closed
wants to merge 1 commit into from
Closed

fix platform fail on p4a #694

wants to merge 1 commit into from

Conversation

xxnet
Copy link

@xxnet xxnet commented Mar 29, 2016

python-for-android executable is not a file so can't be opened.
platform.platform() will fail because get the system arch by parse the executable.

@inclement
Copy link
Member

So this occurs because python is being set up and run via the C script? If that's the case, I'm not sure if we should patch the behaviour out, since it's the normal behaviour of the python interpreter. That said, it seems fine to do so if it's causing problems - is there somewhere in particular where this comes up and should be fixed?

I also wonder if python's internal behaviour is the same in newer versions?

@xxnet
Copy link
Author

xxnet commented Apr 5, 2016

The reason that raise Exception is because python-for-android implement python interpreter as JNI(Java Native Interface), not a standard alone executable file.
platform.platform() get the system libc version by parse the executable file.

I think platform.platform() should return a string on any platform, not raising an Exception.
It same on python 2.7.11 and python 3.4 for this point.

We can use:
try:
platform = platform.platform()
catch:
platform = "anything"

but I don't think this is a good idea.

We can return "Android" and more detail like android version and manufacturer in feature.
May be we can submit this patch to python project.

@inclement
Copy link
Member

Right, my concern is that this is not (apparently) a bug in python-for-android, but in the python interpreter itself. I'm not sure philosophically if we should fix these things with hacky patches, rather than working around them and contributing upstream if necessary.

@xxnet
Copy link
Author

xxnet commented Apr 6, 2016

This error will occur on embedded python interpreter like p4a.
Normal python will not encounter this error.

@inclement
Copy link
Member

I'm going to close this without merging because I still don't think it's the right choice to patch python's natural behaviour when it's not essential. Please do raise it again if you feel strongly about it, I'm happy to discuss it, but when I brought it up on irc people seemed to agree with me.

@inclement inclement closed this May 7, 2016
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

Successfully merging this pull request may close these issues.

2 participants