error dns.resolver.NoResolverConfiguration: None

74 views
Skip to first unread message

Gaurav Bhoi

unread,
Jun 2, 2021, 9:00:49 PM6/2/21
to Kivy users support
Hello guys, I have packaged a kivy application which involves retrieving some information from MongoDB cloud database. but application crashes as soon as it starts. i found a error in log file which i think is a main cause which goes something like "dns.resolver.NoResolverConfiguration: None". i attaching code spec file and log file down below please help. i have remove username and password of mongodb database from code. please help and thank you


Python Code:

from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from pymongo import MongoClient
import urllib.parse

cluster = MongoClient("mongodb+srv://" + urllib.parse.quote("") + ":" + urllib.parse.quote(
        "") + "@cluster0.s1gmp.mongodb.net/myFirstDatabase?retryWrites=true&w=majority")
DataBase = cluster["Employee"]
Collection = DataBase["Employee"]

class Box(BoxLayout):
    def info(self):
        self.ids.name.text = Collection.find_one({'_id': '23145'}).get('name')
        self.ids.designation.text = Collection.find_one({'_id': '23145'}).get('designation')
        self.ids.address.text = Collection.find_one({'_id': '23145'}).get('address')

class MainApp(App):
    def build(self):
        return Box()

if __name__ == '__main__':
    MainApp().run()


Kv Code:

<Box>:
    orientation: 'vertical'

    GridLayout:
        cols: 2

        Label:
            text: 'Name : '

        Label:
            id: name

        Label:
            text: 'designation : '

        Label:
            id: designation

        Label:
            text: 'addresss : '

        Label:
            id: address

    Button:
        text: 'info'
        size_hint_y: .1
        on_release: app.root.info()







buildozer.spec
my_log.txt

Robert

unread,
Jun 3, 2021, 1:06:28 PM6/3/21
to Kivy users support
This is the issue:

6-03 06:15:39.043 13463 13580 I python : File "/home/nexgen/Desktop/Work_Stuff/pymongo_test/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/pymongo_test_2/dns/resolver.py", line 782, in read_resolv_conf 06-03 06:15:39.053 13463 13580 I python : FileNotFoundError: [Errno 2] No such file or directory: '/etc/resolv.conf'

The code is POSIX specific, so not portable. 
It is looking for a Linux OS system file that does not exist on the Android OS. And it did exist it would not be readable.
Clearly this is about dns name resolution.
I don't know how to use the default Android nameserver, I'd guess it is in the developer docs and would be accessed via pyjnius.

But before spending much time on that, check if pymongo needs a resolver for some internal magic of its own, which might complicate the task.
Reply all
Reply to author
Forward
0 new messages