kivy / python-for-android

Turn your Python application into an Android APK
https://python-for-android.readthedocs.io
MIT License
8.34k stars 1.85k forks source link

subprocess.check_output(["ping", "-c", "3", hostname]) non-zero exit code 2 #126

Closed yurkomik closed 11 years ago

yurkomik commented 11 years ago

I wrote a method to check internet connection to host site. simplified version look like this:

def network_check(): hostname = "google.com" try: response = subprocess.check_output(["ping", "-c", "3", hostname]) return response except Exceprion as err: return err

I run this in threading.Thread

This method works ok in linux and subprocess.check_output(["ping", "-c", "3", "google.com"]) works ok in Qpython console on android but in python-for-android&kivy i get exit code 2 (ping other errors)

I've spent hole evening trying to solve the problem. No results. Regards, Yurij

akshayaurora commented 11 years ago

Have you tried --permissions INTERNET, while compiling the apk?

yurkomik commented 11 years ago

Confirming, it works with --permission INTERNET . I thought if there is no internet exitcode is 1 (no reply) THANKS! :)