We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
Kevin B.36
2 months agoCollaborator | Level 9
Find DBID on Local PC
Application Affected My own app Device Windows 11 VM Operating System/Browser (if using the web) Windows 11 Dropbox App Version (if using the app) Latest Question or Issue We have an app tha...
- 24 days ago
Hi again Kevin B.36,
I tried to reproduce your issue, but honestly unsuccessful.
About your speculations: Once setup correctly, Dropbox application doesn't change that file if you haven't forced it (link/unlink account), so "before the Dropbox app has initialized it" in context of just starting - impossible in fact. There is something else possible though. Since that file becomes locked temporary (for short time) at Dropbox application stat moment, your application may be trying read the file at the same time without set enough timeout. On boot time, this lock time may be longer that the default timeout of the sqlite3 library you're using. You may try set explicitly longer connect timeout. It's good idea to trace possible changes in this file and update your application status if/when need (not just to fetch the info at beginning - user may change account at any time) or to check what's there exactly when need at any time your application has to check it (so avoiding keep any status about the account of Dropbox application together with possible hidden bugs).
I used following simple script to check what's going on:
#!/bin/python3 ############################################################################### # Checking for matching third party application account and local Dropbox # application account. # ----------------------------------------------------------------------------- # Author: Здравко # www.dropboxforum.com/t5/user/viewprofilepage/user-id/422790 ############################################################################### from dropbox import Dropbox from pathlib import Path from sqlite3 import connect, OperationalError from tkinter import messagebox # Take a look on your application in https://www.dropbox.com/developers/apps APPLICATION_KEY='PUT YOUR KEY HERE' APPLICATION_SECRET=None # Left None if PKCE is in use or set the actual secret. # Fetch the refresh token used in your main application or create such by hand # (take a look here: # https://www.dropboxforum.com/discussions/101000014/issue-in-generating-access-token/592667/replies/592921 # for instance). REFRESH_TOKEN='PUT YOUR TOKEN HERE' APEX_PATH='PUT YOUR apex.sqlite3 PATH HERE' client=Dropbox(oauth2_refresh_token=REFRESH_TOKEN, app_key=APPLICATION_KEY, app_secret=APPLICATION_SECRET) userInfo=client.users_get_current_account() dbid=userInfo.account_id email=userInfo.email apex=Path(APEX_PATH).expanduser().absolute() try: con = connect(f"file:{apex}?mode=ro", uri=True, timeout=50.0) except OperationalError as e: messagebox.showerror('Check Account', "Local Dropbox application is not yet installed or " f"it is not completely configured!\n\n{e}"); exit(1) try: blobs=list(row[0] for row in con.execute("SELECT value FROM apex_stormcrow")) except OperationalError as e: messagebox.showerror('Check Account', f"Local Dropbox application seems not yet completely configured!\n\n{e}"); con.close() exit(1) con.close() def getDbId(rawData): i=rawData.find(b'dbid:') length=rawData[i-1] return rawData[i:i+length].decode() localDbIds=list(getDbId(blob) for blob in blobs if blob.find(b'dbid:') > 0) if len(localDbIds) == 0: messagebox.showerror('Check Account', "Local Dropbox application is not yet completely configured!\n\n" "No any IDs found."); exit(1) if localDbIds.count(dbid) == 1: messagebox.showinfo('Check Account', "Found local Dropbox application link " "to current third party application account:\n\n" f"account id: {dbid}\n" f"email: {email}"); else: messagebox.showinfo('Check Account', "Current third party application account:\n\n" f"account id: {dbid}\n" f"email: {email}\n\n" "cannot be found in local Dropbox application link(s):\n\n" f"{localDbIds}")Everything works all the time correctly for me. You may try it simultaneous in time of your application test to see possible differences and feed your further debugging. Post strange results of above script if you decide to test it and something suspicious comes up.
All the best!
Kevin B.36
27 days agoCollaborator | Level 9
Hi,
This happened with one of our testers, he reported on a clean install on a clean system there was no apex.sqlite3.
I’m not sure if this is simply an outlier, but let me be clear, are you saying if the app is running on my PC, there will be an apex.sqlite3 file?
thanks, Kevin
- Здравко27 days agoLegendary | Level 20
When you (or your tester) install your application on "clean install" and there is not yet Dropbox application installed, of course, where will apex.sqlite3 will come from?! 🙂 (if that's the case)
The Dropbox folder (both that containing your data and that contain application setting) and everything contained inside are created by Dropbox application installed and running. Wow.. that's confusing.. does your tester really surprise that the file is missing while responsible application is missing (or not yet setup)??? 😂
Of course, to be available that file and to contain valid id there, valid setup (link to account) is need in addition to just install! What would be such id for while there is no any account yet?! 😉
Yes, there should be apex.sqlite3 in condition Dropbox application has been setup correctly (or will come up once this happens as far as I know) if you haven't found something else. Please, share it if you have such.
Good luck!
- Kevin B.3624 days agoCollaborator | Level 9
Hi,
No wrong (my bad - I misunderstood what the tester said). The Dropbox App is running (and it is) the file apex.sqlite3 is available. BUT just at startup of our app, the DBID was NOT in the Apex.sqlite3 file. This I suspect is simply a timing issue.
Our app starts when the system starts and so does the Dropbox App. It's possible (and I'm speculating here) there is a race condition inadvertently setup where our app reads the apex.sqlite3 file before the Dropbox app has initialised it (again spculation).
For the most part it works fine and I'm at the point where we can live with that. I'll experiment with doing a retry some ms later if the apex.sqlite3 file does not have the DBID.
Tnaks for your replies, they were very helpful
Kevin
- Здравко24 days agoLegendary | Level 20
Hi again Kevin B.36,
I tried to reproduce your issue, but honestly unsuccessful.
About your speculations: Once setup correctly, Dropbox application doesn't change that file if you haven't forced it (link/unlink account), so "before the Dropbox app has initialized it" in context of just starting - impossible in fact. There is something else possible though. Since that file becomes locked temporary (for short time) at Dropbox application stat moment, your application may be trying read the file at the same time without set enough timeout. On boot time, this lock time may be longer that the default timeout of the sqlite3 library you're using. You may try set explicitly longer connect timeout. It's good idea to trace possible changes in this file and update your application status if/when need (not just to fetch the info at beginning - user may change account at any time) or to check what's there exactly when need at any time your application has to check it (so avoiding keep any status about the account of Dropbox application together with possible hidden bugs).
I used following simple script to check what's going on:
#!/bin/python3 ############################################################################### # Checking for matching third party application account and local Dropbox # application account. # ----------------------------------------------------------------------------- # Author: Здравко # www.dropboxforum.com/t5/user/viewprofilepage/user-id/422790 ############################################################################### from dropbox import Dropbox from pathlib import Path from sqlite3 import connect, OperationalError from tkinter import messagebox # Take a look on your application in https://www.dropbox.com/developers/apps APPLICATION_KEY='PUT YOUR KEY HERE' APPLICATION_SECRET=None # Left None if PKCE is in use or set the actual secret. # Fetch the refresh token used in your main application or create such by hand # (take a look here: # https://www.dropboxforum.com/discussions/101000014/issue-in-generating-access-token/592667/replies/592921 # for instance). REFRESH_TOKEN='PUT YOUR TOKEN HERE' APEX_PATH='PUT YOUR apex.sqlite3 PATH HERE' client=Dropbox(oauth2_refresh_token=REFRESH_TOKEN, app_key=APPLICATION_KEY, app_secret=APPLICATION_SECRET) userInfo=client.users_get_current_account() dbid=userInfo.account_id email=userInfo.email apex=Path(APEX_PATH).expanduser().absolute() try: con = connect(f"file:{apex}?mode=ro", uri=True, timeout=50.0) except OperationalError as e: messagebox.showerror('Check Account', "Local Dropbox application is not yet installed or " f"it is not completely configured!\n\n{e}"); exit(1) try: blobs=list(row[0] for row in con.execute("SELECT value FROM apex_stormcrow")) except OperationalError as e: messagebox.showerror('Check Account', f"Local Dropbox application seems not yet completely configured!\n\n{e}"); con.close() exit(1) con.close() def getDbId(rawData): i=rawData.find(b'dbid:') length=rawData[i-1] return rawData[i:i+length].decode() localDbIds=list(getDbId(blob) for blob in blobs if blob.find(b'dbid:') > 0) if len(localDbIds) == 0: messagebox.showerror('Check Account', "Local Dropbox application is not yet completely configured!\n\n" "No any IDs found."); exit(1) if localDbIds.count(dbid) == 1: messagebox.showinfo('Check Account', "Found local Dropbox application link " "to current third party application account:\n\n" f"account id: {dbid}\n" f"email: {email}"); else: messagebox.showinfo('Check Account', "Current third party application account:\n\n" f"account id: {dbid}\n" f"email: {email}\n\n" "cannot be found in local Dropbox application link(s):\n\n" f"{localDbIds}")Everything works all the time correctly for me. You may try it simultaneous in time of your application test to see possible differences and feed your further debugging. Post strange results of above script if you decide to test it and something suspicious comes up.
All the best!
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!