1

I'm trying to use Panda3D in a Jupyter Notebook, but I'm having problems loading a model (i.e. an .egg file).

This snippet of code runs at the command line but not in a Jupyter Notebook:

from direct.showbase.ShowBase import ShowBase    
from panda3d.core import Filename

class MyApp(ShowBase):
    def __init__(self):
        ShowBase.__init__(self)

    def load_a_model(self):
        panda_file = Filename.fromOsSpecific('models\\myModel')
        obj_model = self.loader.loadModel(panda_file)

anApp = MyApp()
anApp.load_a_model()
anApp.run()

The error given by Jupyter Notebook is:

---------------------------------------------------------------------------
IOError                                   Traceback (most recent call last)
<ipython-input-1-c9c9444b3a7f> in <module>()
     11 
     12 anApp = MyApp()
---> 13 anApp.load_a_model()
     14 anApp.run()

<ipython-input-1-c9c9444b3a7f> in load_a_model(self)
      8     def load_a_model(self):
      9         panda_file = Filename.fromOsSpecific('models\\myModel')
---> 10         obj_model = self.loader.loadModel(panda_file)
     11 
     12 anApp = MyApp()

C:\Panda3D-1.9.3-x64\direct\showbase\Loader.pyc in loadModel(self, modelPath, loaderOptions, noCache, allowInstance, okMissing, callback, extraArgs, priority)
    168             if not okMissing and None in result:
    169                 message = 'Could not load model file(s): %s' % (modelList,)
--> 170                 raise IOError, message
    171 
    172             if gotList:

IOError: Could not load model file(s): [Filename('models/myModel')]

Any idea what the problem is?

user3731622
  • 4,844
  • 8
  • 45
  • 84

1 Answers1

0

Panda3D uses platform-independent paths, so you should use a forward slash instead of a backward slash. So, specify models/myModel.

rdb
  • 1,488
  • 1
  • 14
  • 24