More friendly debug tools?

In this forum we discuss the future of Ren'Py, both bug fixes and longer-term development. Pre-releases are announced and discussed here.
Post Reply
Message
Author
Strec
Newbie
Posts: 6
Joined: Sat Jan 07, 2017 9:36 pm
Projects: Parallel
Location: France
Contact:

More friendly debug tools?

#1 Post by Strec »

For now, while dev, I'm blocked on a save bug giving this log

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 34, in script call
    call showScreenMain
  File "game/script.rpy", line 49, in script
    python:
  File "game/script.rpy", line 56, in <module>
    renpy.pause(0.01)
  File "renpy/common/00action_file.rpy", line 357, in __call__
    renpy.save(fn, extra_info=save_name)
PicklingError: Can't pickle <type 'module'>: it's not found as __builtin__.module

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

Full traceback:
  File "game/script.rpy", line 34, in script call
    call showScreenMain
  File "game/script.rpy", line 49, in script
    python:
  File "F:\RenPy\renpy-6.99.12.2-sdk\renpy\ast.py", line 814, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "F:\RenPy\renpy-6.99.12.2-sdk\renpy\python.py", line 1719, in py_exec_bytecode
    exec bytecode in globals, locals
  File "game/script.rpy", line 56, in <module>
    renpy.pause(0.01)
  File "F:\RenPy\renpy-6.99.12.2-sdk\renpy\exports.py", line 1278, in pause
    rv = renpy.ui.interact(mouse='pause', type='pause', roll_forward=roll_forward)
  File "F:\RenPy\renpy-6.99.12.2-sdk\renpy\ui.py", line 285, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "F:\RenPy\renpy-6.99.12.2-sdk\renpy\display\core.py", line 2526, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, **kwargs)
  File "F:\RenPy\renpy-6.99.12.2-sdk\renpy\display\core.py", line 3204, in interact_core
    rv = root_widget.event(ev, x, y, 0)
  File "F:\RenPy\renpy-6.99.12.2-sdk\renpy\display\layout.py", line 960, in event
    rv = i.event(ev, x - xo, y - yo, cst)
  File "F:\RenPy\renpy-6.99.12.2-sdk\renpy\display\layout.py", line 960, in event
    rv = i.event(ev, x - xo, y - yo, cst)
  File "F:\RenPy\renpy-6.99.12.2-sdk\renpy\display\layout.py", line 960, in event
    rv = i.event(ev, x - xo, y - yo, cst)
  File "F:\RenPy\renpy-6.99.12.2-sdk\renpy\display\screen.py", line 651, in event
    rv = self.child.event(ev, x, y, st)
  File "F:\RenPy\renpy-6.99.12.2-sdk\renpy\display\layout.py", line 960, in event
    rv = i.event(ev, x - xo, y - yo, cst)
  File "F:\RenPy\renpy-6.99.12.2-sdk\renpy\display\layout.py", line 960, in event
    rv = i.event(ev, x - xo, y - yo, cst)
  File "F:\RenPy\renpy-6.99.12.2-sdk\renpy\display\behavior.py", line 889, in event
    return handle_click(self.clicked)
  File "F:\RenPy\renpy-6.99.12.2-sdk\renpy\display\behavior.py", line 824, in handle_click
    rv = run(action)
  File "F:\RenPy\renpy-6.99.12.2-sdk\renpy\display\behavior.py", line 299, in run
    new_rv = run(i, *args, **kwargs)
  File "F:\RenPy\renpy-6.99.12.2-sdk\renpy\display\behavior.py", line 306, in run
    return action(*args, **kwargs)
  File "renpy/common/00action_file.rpy", line 357, in __call__
    renpy.save(fn, extra_info=save_name)
  File "F:\RenPy\renpy-6.99.12.2-sdk\renpy\loadsave.py", line 286, in save
    dump((roots, renpy.game.log), logf)
  File "F:\RenPy\renpy-6.99.12.2-sdk\renpy\loadsave.py", line 47, in dump
    pickle.dump(o, f, pickle.HIGHEST_PROTOCOL)
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 1370, in dump
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 224, in dump
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 286, in save
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 548, in save_tuple
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 331, in save
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 419, in save_reduce
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 286, in save
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 649, in save_dict
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 681, in _batch_setitems
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 286, in save
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 600, in save_list
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 633, in _batch_appends
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 331, in save
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 419, in save_reduce
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 286, in save
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 649, in save_dict
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 681, in _batch_setitems
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 331, in save
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 419, in save_reduce
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 286, in save
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 649, in save_dict
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 681, in _batch_setitems
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 331, in save
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 419, in save_reduce
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 286, in save
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 649, in save_dict
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 681, in _batch_setitems
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 286, in save
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 649, in save_dict
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 681, in _batch_setitems
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 286, in save
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 600, in save_list
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 633, in _batch_appends
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 331, in save
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 419, in save_reduce
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 286, in save
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 649, in save_dict
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 681, in _batch_setitems
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 331, in save
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 419, in save_reduce
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 286, in save
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 649, in save_dict
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 681, in _batch_setitems
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 331, in save
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 416, in save_reduce
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 681, in _batch_setitems
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 331, in save
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 396, in save_reduce
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 286, in save
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/pickle.py", line 748, in save_global
PicklingError: Can't pickle <type 'module'>: it's not found as __builtin__.module

Windows-8-6.2.9200
Ren'Py 6.99.12.4.2187
BIOT 0.1.0
{size=10}(Lang 00 - Défaut){/size}
I suppose the inportant line is
pickle.dump(o, f, pickle.HIGHEST_PROTOCOL)
saying process can't dump an object but how is it possible to know with object is concerned and what is clearly the problem?

User avatar
PyTom
Ren'Py Creator
Posts: 16088
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: More friendly debug tools?

#2 Post by PyTom »

When it comes to this problem, there are two things you can do to make debugging it easier:

Code: Select all

define config.use_cpickle = False
define config.save_dump = True
The first will improve the error message, while the second will create a file named save_dump.txt with everything being saved in it. (If you see a module, that's your problem.)

This generally comes down to code like:

Code: Select all

python:
    import modulename
Imports should only ever happen inside an init python block, since Ren'Py can't save modules.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

Strec
Newbie
Posts: 6
Joined: Sat Jan 07, 2017 9:36 pm
Projects: Parallel
Location: France
Contact:

Re: More friendly debug tools?

#3 Post by Strec »

Thanks, you win :)

As said I tryed a lot of thing I did found on the web like define config.use_cpickle = False but did not know about your second tip, I'll try it.

I did find the problem by using old-school debugging (module by module, line by line, ...) and it was what you said, I used an 'import' in a screen (import time), provoking the crash.

Post Reply

Who is online

Users browsing this forum: No registered users