Fail to read and write file using xbmcvfs.File in Frodo
#31
Hmm, writing of a null byte is a absolute must for me...
Pneumatic | SABnzbd | XBMC that just works - openelec
Reply
#32
The current API can handle binary files as long as there's a null byte at the end of the file (albeit clumsily - split binary file into segments separated by the null bytes there-of), but can't handle writing a text file.

The proposed change will handle writing text files but won't handle binary files.

The only way to handle binary files is to have a size passed into the write() function along with the buffer.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#33
(2013-01-09, 00:09)jmarshall Wrote: The only way to handle binary files is to have a size passed into the write() function along with the buffer.

If that will work I'm ok.
Pneumatic | SABnzbd | XBMC that just works - openelec
Reply
#34
Actually the current API cannot handle binary that has any null bytes included (i.e. (\xa5\xa3\x00\xa5\xb3), the write would stop at the null byte due to it's use of 'strlen' to determine the buffer's size. This really should have a byte buffer with a length to be useful for binary files, however, I thought that API changes to frodo were frozen and that only fixes were being allowed for now? Ronie's update at least accomplishes making the API perform as documented: http://mirrors.xbmc.org/docs/python-docs...File-write

Technically the 'null' byte is not part of the buffer but a programmatic signal as to the end of the buffer and should never be included as part of the data.

BTW, thanks Ronie for making the change.

Best,
guitardood
Reply
#35
Not to belabor the point, but:

Quote:albeit clumsily - split binary file into segments separated by the null bytes there-of

You'd do that on the python side and send the segments without the null bytes.

The bigger point is that we cannot fix it for all binary writing without changing the API. I suspect this is unacceptable at this point in the release cycle, thus fixing the ascii writing at least gets one of them working.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#36
I'm not really following but adding a optional size to write(buffer [,size]) whit the limitation that if not size is specified, null bytes will not be written?
Pneumatic | SABnzbd | XBMC that just works - openelec
Reply
#37
https://github.com/xbmc/xbmc/pull/2053 screwed up binary writing. This completely ruins my addon...
Pneumatic | SABnzbd | XBMC that just works - openelec
Reply
#38
did it work in xbmc eden?
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#39
Eh, no... Blush I was using the "experimental" xbmcvfs.write to be able to write to nfs/smb shares. I just solved it by writing the files locally and then use xbmcvfs.copy(). Not as nice and general but it works....

Pneumatic | SABnzbd | XBMC that just works - openelec
Reply
#40
There seems to be issues with read() with the most recent changes.

all thats thrown in python is.

Quote:10:33:21 T:1152 NOTICE: Unknown exception thrown from the call "read"
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#41
(2013-03-11, 16:27)Nuka1195 Wrote: There seems to be issues with read() with the most recent changes.

all thats thrown in python is.

Quote:10:33:21 T:1152 NOTICE: Unknown exception thrown from the call "read"

fix pending:
2425 (PR)
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#42
https://github.com/xbmc/xbmc/commit/5cae...78e63658d5

didn't fix my issue. i'm trying to read text files written with xbmcvfs.write() am i suppose to use readBytes() now for text files. i can supply a text file, but it's just text. Smile
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#43
Quote:15:36:59 T:1320 NOTICE: Negative size passed to PyByteArray_FromStringAndSize

is what i get with readBytes()
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#44
mind posting a comment about it on the PR?
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply

Logout Mark Read Team Forum Stats Members Help
Fail to read and write file using xbmcvfs.File in Frodo0