Page 1 of 1

Pickling Error when saving under certain labels

Posted: Fri Jul 03, 2015 10:06 pm
by dvcaputo
Hi!
So when I try to save while playing in certain label sections/story paths in the visual novel I'm working on, I get this error:
I'm sorry, but an uncaught exception occurred.

While running game code:
File "renpy/common/00gamemenu.rpy", line 163, in script
$ ui.interact()
File "renpy/common/00gamemenu.rpy", line 163, in <module>
$ ui.interact()
File "renpy/common/00action_file.rpy", line 261, in __call__
renpy.save(fn, extra_info=save_name)
PicklingError: Can't pickle <type 'module'>: attribute lookup __builtin__.module failed

-- Full Traceback ------------------------------------------------------------

Full traceback:
File "renpy/common/00gamemenu.rpy", line 163, in script
$ ui.interact()
File "/Applications/renpy-6.99.4-sdk/renpy/ast.py", line 785, in execute
renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
File "/Applications/renpy-6.99.4-sdk/renpy/python.py", line 1448, in py_exec_bytecode
exec bytecode in globals, locals
File "renpy/common/00gamemenu.rpy", line 163, in <module>
$ ui.interact()
File "/Applications/renpy-6.99.4-sdk/renpy/ui.py", line 277, in interact
rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
File "/Applications/renpy-6.99.4-sdk/renpy/display/core.py", line 2276, in interact
repeat, rv = self.interact_core(preloads=preloads, **kwargs)
File "/Applications/renpy-6.99.4-sdk/renpy/display/core.py", line 2907, in interact_core
rv = root_widget.event(ev, x, y, 0)
File "/Applications/renpy-6.99.4-sdk/renpy/display/layout.py", line 877, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "/Applications/renpy-6.99.4-sdk/renpy/display/transition.py", line 45, in event
return self.new_widget.event(ev, x, y, st) # E1101
File "/Applications/renpy-6.99.4-sdk/renpy/display/layout.py", line 877, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "/Applications/renpy-6.99.4-sdk/renpy/display/layout.py", line 877, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "/Applications/renpy-6.99.4-sdk/renpy/display/screen.py", line 625, in event
rv = self.child.event(ev, x, y, st)
File "/Applications/renpy-6.99.4-sdk/renpy/display/layout.py", line 877, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "/Applications/renpy-6.99.4-sdk/renpy/display/layout.py", line 877, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "/Applications/renpy-6.99.4-sdk/renpy/display/layout.py", line 877, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "/Applications/renpy-6.99.4-sdk/renpy/display/behavior.py", line 785, in event
return handle_click(self.clicked)
File "/Applications/renpy-6.99.4-sdk/renpy/display/behavior.py", line 728, in handle_click
rv = run(action)
File "/Applications/renpy-6.99.4-sdk/renpy/display/behavior.py", line 283, in run
new_rv = run(i, *args, **kwargs)
File "/Applications/renpy-6.99.4-sdk/renpy/display/behavior.py", line 290, in run
return var(*args, **kwargs)
File "renpy/common/00action_file.rpy", line 261, in __call__
renpy.save(fn, extra_info=save_name)
File "/Applications/renpy-6.99.4-sdk/renpy/loadsave.py", line 275, in save
dump((roots, renpy.game.log), logf)
File "/Applications/renpy-6.99.4-sdk/renpy/loadsave.py", line 43, in dump
cPickle.dump(o, f, cPickle.HIGHEST_PROTOCOL)
PicklingError: Can't pickle <type 'module'>: attribute lookup __builtin__.module failed

Darwin-12.3.0-x86_64-i386-64bit
Ren'Py 6.99.4.467
The save function works perfectly in all the other sections though! I'm not sure what's up!

Thanks so much ^__^

Re: Pickling Error when saving under certain labels

Posted: Sat Jul 04, 2015 5:54 am
by xela
You may have imports like:

Code: Select all

import os
in labels, they all belong in init python and never in labels.

Re: Pickling Error when saving under certain labels

Posted: Sat Jul 04, 2015 2:12 pm
by dvcaputo
omg it worked!!! I was importing random within one of the labels and putting it up top solved it!

Thanks SO much! You're a life saver!