Code: Select all
Exception: Could not pickle <module 'math' (built-in)>. (perhaps store.math = <module 'math' (built-in)>)
Code: Select all
label move (from_loc, to_loc):
python:
import math
go_from = locations[from_loc]
go_to = locations[to_loc]
dx = abs( go_from[2] - go_to[2] )
dy = abs( go_from[3] - go_to[3] )
distance = int( math.sqrt( dx**2 + dy**2 ) )
mess = "Flying from {i}[go_from[1]]{/i} to {i}[go_to[1]]{/i}.\nDistance: [distance] km."
call screen confirm(mess, yes_action=Return("go"), no_action=Return("no"))
#...and so on...
Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
File "renpy/common/00action_file.rpy", line 382, in __call__
renpy.save(fn, extra_info=save_name)
Exception: Could not pickle <module 'math' (built-in)>. (perhaps store.math = <module 'math' (built-in)>)
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "renpy/common/_layout/screen_load_save.rpym", line 35, in script
$ ui.interact()
File "/home/otto/Games/RenPy/renpy-7.4.8-sdk/renpy/ast.py", line 923, in execute
renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
File "/home/otto/Games/RenPy/renpy-7.4.8-sdk/renpy/python.py", line 2235, in py_exec_bytecode
exec(bytecode, globals, locals)
File "renpy/common/_layout/screen_load_save.rpym", line 35, in <module>
$ ui.interact()
File "/home/otto/Games/RenPy/renpy-7.4.8-sdk/renpy/ui.py", line 298, in interact
rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
File "/home/otto/Games/RenPy/renpy-7.4.8-sdk/renpy/display/core.py", line 3276, in interact
repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, pause=pause, pause_start=pause_start, **kwargs)
File "/home/otto/Games/RenPy/renpy-7.4.8-sdk/renpy/display/core.py", line 4110, in interact_core
rv = root_widget.event(ev, x, y, 0)
File "/home/otto/Games/RenPy/renpy-7.4.8-sdk/renpy/display/layout.py", line 1090, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "/home/otto/Games/RenPy/renpy-7.4.8-sdk/renpy/display/transition.py", line 48, in event
return self.new_widget.event(ev, x, y, st) # E1101
File "/home/otto/Games/RenPy/renpy-7.4.8-sdk/renpy/display/layout.py", line 1090, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "/home/otto/Games/RenPy/renpy-7.4.8-sdk/renpy/display/layout.py", line 1090, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "/home/otto/Games/RenPy/renpy-7.4.8-sdk/renpy/display/screen.py", line 720, in event
rv = self.child.event(ev, x, y, st)
File "/home/otto/Games/RenPy/renpy-7.4.8-sdk/renpy/display/layout.py", line 1090, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "/home/otto/Games/RenPy/renpy-7.4.8-sdk/renpy/display/layout.py", line 1297, in event
rv = super(Window, self).event(ev, x, y, st)
File "/home/otto/Games/RenPy/renpy-7.4.8-sdk/renpy/display/layout.py", line 273, in event
rv = d.event(ev, x - xo, y - yo, st)
File "/home/otto/Games/RenPy/renpy-7.4.8-sdk/renpy/display/layout.py", line 1090, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "/home/otto/Games/RenPy/renpy-7.4.8-sdk/renpy/display/layout.py", line 1090, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "/home/otto/Games/RenPy/renpy-7.4.8-sdk/renpy/display/layout.py", line 273, in event
rv = d.event(ev, x - xo, y - yo, st)
File "/home/otto/Games/RenPy/renpy-7.4.8-sdk/renpy/display/behavior.py", line 979, in event
return handle_click(self.clicked)
File "/home/otto/Games/RenPy/renpy-7.4.8-sdk/renpy/display/behavior.py", line 914, in handle_click
rv = run(action)
File "/home/otto/Games/RenPy/renpy-7.4.8-sdk/renpy/display/behavior.py", line 329, in run
return action(*args, **kwargs)
File "renpy/common/00action_file.rpy", line 382, in __call__
renpy.save(fn, extra_info=save_name)
File "/home/otto/Games/RenPy/renpy-7.4.8-sdk/renpy/loadsave.py", line 420, in save
reraise(t, e, tb)
File "/home/otto/Games/RenPy/renpy-7.4.8-sdk/renpy/loadsave.py", line 401, in save
dump((roots, renpy.game.log), logf)
File "/home/otto/Games/RenPy/renpy-7.4.8-sdk/renpy/loadsave.py", line 49, in dump
cPickle.dump(o, f, cPickle.HIGHEST_PROTOCOL)
File "/home/otto/Games/RenPy/renpy-7.4.8-sdk/renpy/python.py", line 2332, in module_pickle
raise Exception("Could not pickle {!r}.".format(module))
Exception: Could not pickle <module 'math' (built-in)>. (perhaps store.math = <module 'math' (built-in)>)
Linux-5.10.53-1-MANJARO-x86_64
Ren'Py 7.4.8.1895
Luft Empire 0.2
PS. Solved: import libraries at the init time (init python).