Particle Effects problem

So I first tried to use particle effects, and since the manual was incomplete, I decided to look at the particle example, and used the stock smoke.ptf and texture.
I came out with this:

self.flash = ParticleEffect()

But it simply gives me this error:

  File "C:\Panda3D-1.7.0\direct\particles\", line 201, in loadConfig
    data = vfs.readFile(filename, 1)
AssertionError: okflag at line 121 of c:\panda3d-1.7.0\built\include\virtualFileSystem.I

Any help in solving this?

It just means the file wasn’t found. Try giving a more complete path.


You might have to set the model path, like:

from panda3d.core import loadPrcFileData
loadPrcFileData("", "model-path $MAIN_DIR/assets/mymodel")

Or, if you get this executing a sample or demo file, the paths may be set absolutely instead of relatively. In that case you have to change directory to that demo.

Making it an absolute file path still doesn’t work, nor the file path method.

Well, where is smoke.ptf on your disk? What file path were you using to access it?


Its on the same folder as my main py file, basically C:/Python/smoke.ptf

Did you follow Panda’s filename convention and load it with ‘/c/Python/smoke.ptf’?


Still gives the same issue.

Well, nevertheless, the assertion error indicates the file was not found, or could not be opened for reading.

Can you read the file in Python?

f = Filename('/c/Python/smoke.ptf')
print f.exists()
print vfs.readFile(f, 1)
print open(f.toOsSpecific(), 'r').read()


Huh, it seems that I just replaced the file again with the original(even though I never edited it) and it works. The relative path does not work sadly, but the absolute path does.

if you use relative path’s make sure they are correct…

import os
print os.getcwd()

I have put absolute path but still it is giving this error

File “C:\Panda3D-1.10.11-x64\direct\particles\”, line 205, in loadConfig
data = vfs.readFile(filename, 1)
OSError: Failed to read file: ‘C:\Users\thinkpad\OneDrive\Documents\Sleigh-Ride-main\src\snow.ptf’

It might be that you’re using Windows file-path formatting, where Panda instead uses Linux-style file-path formatting, I believe.

Perhaps try passing your file-name to Panda in a manner something like this:

That said, let me note that I’d suggest that you be wary about using absolute file-paths: they tend to become invalid as soon as you move the project (such as via installing the program onto a new machine). I do recommend using relative file-paths.

with linux file path format it is still giving the same error and relative path is also giving same error.
none of the way is working

All right, in that case would you mind checking that the file is in the indicated location on the computer?

In particular, would you please post a screenshot of your file-browser, showing the file and the file-path?

Perhaps there’s some minor error or issue in the path that’s confusing the file-loading.

this is the image of my project file main file and ptf is on the same directory I could not understand what is the problem.

Hmm… I’m not familiar with the way that Windows is displaying your file-path, but it doesn’t look like your file is under “OneDrive”–it looks like it’s under “This PC” (or perhaps an expansion that is abbreviated as “This PC”).

yes it was some path issue now I have cut and pasted my files on the desktop now it is working properly. thanks for your time. I did not properly understand what was the issue but it is resolved now. thanks once again!

1 Like