More packp3d errors...

I don’t know if anyone here has ever worked with jsonpickle before but it’s getting on my nerves… I import it normally using “import jsonpickle” (and jsonpickle is a folder in my main directory containing multiple .py files). The pickled data encodes and decodes perfectly during normal python runtime, but of course packp3d always has to make it a pain…

Traceback (most recent call last):
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\p3d\Ap
pRunner.py", line 638, in run
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\task\T
ask.py", line 502, in run
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\task\T
ask.py", line 460, in step
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showba
se\Messenger.py", line 424, in __taskChainDispatch
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showba
se\Messenger.py", line 482, in __dispatch
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\p3d\Ap
pRunner.py", line 748, in __startIfReady
  File "VFSImporter", line 153, in load_module
  File "C:\Users\Patrick\Desktop\FunnyFarm\funny_farm_userBuild.py", line 10, in
 <module>
    from funnyfarm.main.load.Loaders import *
  File "VFSImporter", line 153, in load_module
  File "C:\Users\Patrick\Desktop\FunnyFarm\funnyfarm\main\load\Loaders.py", line
 26, in <module>
    from funnyfarm.main.makeatoon.DataManager import *
  File "VFSImporter", line 153, in load_module
  File "C:\Users\Patrick\Desktop\FunnyFarm\funnyfarm\main\makeatoon\DataManager.
py", line 67, in <module>
    start_game()
  File "C:\Users\Patrick\Desktop\FunnyFarm\funnyfarm\main\makeatoon\DataManager.
py", line 65, in start_game
    game_state = load_game()
  File "C:\Users\Patrick\Desktop\FunnyFarm\funnyfarm\main\makeatoon\DataManager.
py", line 33, in load_game
    state = jsonpickle.decode(savegame.read())
AttributeError: 'module' object has no attribute 'decode'
:TaskManager: TaskManager.destroy()
:display: Closing wglGraphicsWindow
Failure on startup.

Any help on this would be appreciated.

Can you show the result of “multify -tvf yourfile.p3d” ?

      97   29%    Nov 15 11:50 jsonpickle/__init__.pyo
    1387   51%    Nov 15 11:50 jsonpickle/__init__/__init__.pyo
    4929   60%    Nov 15 11:50 jsonpickle/backend.pyo
     778   42%    Nov 15 11:50 jsonpickle/compat.pyo
    7317   69%    Nov 15 11:50 jsonpickle/handlers.pyo
   11688   62%    Nov 15 11:50 jsonpickle/pickler.pyo
     807   41%    Nov 15 11:50 jsonpickle/tags.pyo
   14247   64%    Nov 15 11:50 jsonpickle/unpickler.pyo
    8250   67%    Nov 15 11:50 jsonpickle/util.pyo
     171   18%    Nov 15 11:50 jsonpickle/version.pyo

This isn’t the full outcome, but it’s everything that has to do with jsonpickle. The full outcome is much too long to fit in here, nor even the command window. jsonpickle/backend.py is where the encode() and decode() functions are located.

I’m a bit surprised at the existence of the jsonpickle/init directory. Does that directory occur in the source code of jsonpickle as well?

No. That seems to happen with every directory that contains an init.py upon p3d compilation.

Ah, I found a work-around. I figured out that the encode() and decode() functions I’m using are actually coming from the pickler.py and unpickler.py. So I just imported those modules directly into my main.py, and everything saves and loads fine and dandy. The only problem now is that I have to reference everything from my data.json as a dictionary instead of an object. But that’s not a big deal.