Multifile.addSubfile in buildbot version

I’ve encountered a problem with newest development snapshot. When I try to add something to a Multifile with:

mf.addSubfile("file", Filename("./tmp/file"), 1)

I get this error:

AssertionError: fname.is_binary_or_text() at line 489 of panda/src/express/multifile.cxx

I thought the API has changed and that the second argument should now be passed as a string, rather than Filename, but that’s not the case, as it complains about incorrect argument type.

I’m on Ubuntu 10.10 amd64. It works flawlessly in 1.7.2.

You now need to specify whether the file should be read in binary or text mode (equivalent to ‘rb’ or ‘r’ in the Python open() call). Use:

mf.addSubfile("file", Filename.binaryFilename("./tmp/file"), 1)


mf.addSubfile("file", Filename.textFilename("./tmp/file"), 1)


Thank you. :slight_smile:

Thanks, David :slight_smile:
Wrote this

from direct.stdpy.file import *
from pandac.PandaModules import VirtualFileSystem
from pandac.PandaModules import Multifile
from pandac.PandaModules import Filename

m = Multifile()

# Add a new file to the multifile
m.addSubfile("a.txt", Filename.textFilename("a.txt"), 1)

Got this.

D:\Distr\VIM\vim73>ppython C:\Panda3D-1.8.0\game\
Assertion failed: is_write_valid() at line 482 of c:\buildslave\dev_sdk_win32\bu
Traceback (most recent call last):
  File "C:\Panda3D-1.8.0\game\", line 12, in <module>
    m.addSubfile("a.txt", Filename.textFilename("a.txt"), 1)
AssertionError: is_write_valid() at line 482 of c:\buildslave\dev_sdk_win32\buil

Please, help - What’s wrong?
a.txt is in the same place as

I pasted that code, and it works fine for me. The assertion error means that the Multifile wasn’t open in write mode (or it wasn’t open at all). Of course, in this code snippet, it must be open because you just called openReadWrite(), unless for some reason the open failed (and you don’t check the return value of openReadWrite(), so maybe it did fail?).