question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

can't import Contacts

See original GitHub issue

This code crashes without catching Exception:

def build(self):
    try:
        return Label(text=str(dir(autoclass('android.provider.ContactsContract.Contacts'))).replace(' ', '\n'))
    except Exception as ex:
        return Label(text=str(ex).replace(' ', '\n'))

this case

def build(self):
    try:
        contract = autoclass('android.provider.ContactsContract')
        return Label(text=str(dir(contract.Contacts)).replace(' ', '\n'))
    except Exception as ex:
        return Label(text=str(ex).replace(' ', '\n')) 

catching Exception type object ‘android.provider.ContactsContract’ has no attribute ‘Contacts’

but I expect that such a class exists: http://developer.android.com/intl/ru/reference/android/provider/ContactsContract.Contacts.html

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
pythonic64commented, Nov 11, 2015

Try importing Contacts directly, like:

Contacts = autoclass('android.provider.ContactsContract$Contacts')

‘$’ is for accessing nested classes.

1reaction
Intasircommented, Sep 25, 2018

how can i Access full contact list ,can anyone help??

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to solve problems of importing to Google Contacts
One way to solve the problems of importing files into Google Contacts is to make sure that you are using the correct CSV...
Read more >
Fix problems importing contacts to Outlook.com
Try importing your .csv file with a few contacts to make sure you like the results. Afterwards, you can delete the imported contacts,...
Read more >
Add, move, or import contacts - Computer - Google Support
On your computer, go to Google Contacts. At the left, click Import. Click Select File. Choose your file. Click Import. ... Step 1:...
Read more >
The File You're Importing isn't Formatted for Google Contacts ...
In order to fix the file, you're importing isn't formatted for Google Contacts error, first, you need to make the CSV file Google...
Read more >
If an app can't import vCards into Contacts on Mac
Contacts exports contact information as vCard 3.0 files, but some apps don't accept files in this format. If an app can't import vCards...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found