[PyQt] pyqtdeploy: data file access on IOS

Drembedded drembedded at yahoo.com
Wed Feb 25 17:37:42 GMT 2015


Lloyd,

Yes I would agree that this seems to be a limitation in sqlite. I had 
hoped that there was an alternate connect() method that would take a 
file descriptor as an argument as QFile can return its file descriptor, 
unfortunately no such luck.

How difficult would it be to "connect" the resource file the python 
filesystem as a read-only filesystem? Or perhaps "hook" the open() 
command and somehow insert pyqt's resource file system.

Cheers,
Michael

On 2/25/15 5:28 AM, lloyd konneker wrote:
> Just talking, to check our understanding ...
>
> So 'pyqt's resource file system' is not a file system of the OS, and 
> must be accessed via Qt functions.  Sqllite does not use those Qt 
> functions.
>
> It seems to me it is a limitation of Sqllite:   it only supports file 
> systems offered by the OS, and doesn't allow the database data to be 
> in say a stream that you can pass to connect().  I am not sure if that 
> makes sense, I suppose the data file must offer block access instead 
> of just sequential access for it to be of use as a database.  Unless 
> you are really talking about a small amount of data, or data for which 
> you really don't need relational database access.
>
>
> On 02/24/2015 06:17 PM, Drembedded wrote:
>> Lloyd,
>>
>> Thank you for your response. Doing this results in the same directory 
>> structure: ':/pyqtdeploy_ptest1' that I've hardcoded into the 
>> sqlite3.connect() call: essentially the directory within the resource 
>> file.
>>
>> Thats a great way to discover the full path into the resource file if 
>> you're using pyqt calls but unfortunately any other methods that use 
>> "standard Python file access functions such as sqlite3.connect() 
>> don't seem to be able to access the pyqt's resource file system.
>>
>> This limitation is noted in the tutorial: 
>> http://pyqt.sourceforge.net/Docs/pyqtdeploy/tutorial.html
>>
>> Note
>>
>> Non-Python (i.e. data) files can also be included in the package. An 
>> application typically accesses such files by using 
>> theQFileInfo.absolutePath()function on the__file__attribute of a 
>> module to obtain the name of the directory containing the data file. 
>> This approach will also work with deployed applications so long as 
>> the file is accessed using theQFileclass (rather than the standard 
>> Python file access functions). However QML files require slightly 
>> different treatment as their locations are specified using a URL.
>>
>>
>>
>> So right now my only way around this issue is to copy my sqlite3 
>> database file on to the IPad's file system which I can "see" using 
>> standrd Pythn file access functions such as 
>> pprint.pprint(os.listdir()) which returns:
>>
>> ['.Trashes',
>>
>> '.file',
>>
>> '.fseventsd',
>>
>> 'Applications',
>>
>> 'Developer',
>>
>> 'Library',
>>
>> 'System',
>>
>> 'bin',
>>
>> 'cores',
>>
>> 'dev',
>>
>> 'etc',
>>
>> 'private',
>>
>> 'sbin',
>>
>> 'tmp',
>>
>> 'usr',
>>
>> 'var']
>>
>>
>> Hopefully someone at Riverbank will chime in here and set me straight.
>>
>> Cheers,
>> Michael
>>
>> On 2/24/15 5:36 AM, lloyd konneker wrote:
>>> Did you try using __file__ per the documentation here: 
>>> http://pyqt.sourceforge.net/Docs/pyqtdeploy/pyrcc.html ??
>>>
>>>
>>> _______________________________________________
>>> PyQt mailing list PyQt at riverbankcomputing.com
>>> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20150225/db78f3e8/attachment-0001.html>


More information about the PyQt mailing list