[PyQt] pyqtdeploy: data file access on IOS

Michael James drembedded at yahoo.com
Mon Feb 23 23:47:01 GMT 2015

I'm having a heck of a time accessing an sqlite3 database file that's in the resource file.
This doesn't throw an error:  dbFileName=':/pyqtdeploy_ptest1/testSqlite3.db'  qtDbFile=QtCore.QFile(dbFileName)So I know that the file exists and can be sen by the pyqt APIs
But according to the tutorial we can't use the "standard Python file access functions"  http://pyqt.sourceforge.net/Docs/pyqtdeploy/tutorial.htmlSo something like this is a no-no:  dbFileName=':/pyqtdeploy_ptest1/testSqlite3.db'

Unfortunately the sqlite3.connect() call takes a file name. 
I've tried with and without the ':' character.    conn = sqlite3.connect(":/pyqtdeploy_ptest1/testSqlite3.db?mode=ro")   conn = sqlite3.connect("/pyqtdeploy_ptest1/testSqlite3.db?mode=ro")I've even tried the uri argument approach:
   conn = sqlite3.connect("file:/pyqtdeploy_ptest1/testSqlite3.db?mode=ro", uri=True)and with an extra ':' character:   conn = sqlite3.connect("file::/pyqtdeploy_ptest1/testSqlite3.db?mode=ro", uri=True)
The error I keep getting is:   sqlite3.OperationalError: unable to open database file
 I've thought about using QFile, getting the file descriptor and then copying the file to the IPad's /tmp directory but that's my last resort.
What would be the proper way to open the sqlite3 database?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20150223/1b2eae53/attachment.html>

More information about the PyQt mailing list