could not pickle [module 'time' (built-in)>

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
sittingox
Newbie
Posts: 11
Joined: Wed Nov 15, 2023 7:33 pm
Contact:

could not pickle [module 'time' (built-in)>

#1 Post by sittingox »

Basically, my game works fine but when I try to bring up the interactive director this error code pops up. No clue what it means. Thoughts anyone?

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "renpy/common/00keymap.rpy", line 485, in script
    python hide:
  File "renpy/common/00keymap.rpy", line 485, in <module>
    python hide:
  File "renpy/common/00keymap.rpy", line 509, in _execute_python_hide
    renpy.save("_reload-1", "reload save game")
Exception: Could not pickle <module 'time' (built-in)>. (perhaps store.time = <module 'time' (built-in)>)

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

Full traceback:
  File "renpy/common/00keymap.rpy", line 485, in script
    python hide:
  File "C:\Users\nguye\Desktop\renpy-8.1.3-sdk\renpy\ast.py", line 1138, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "C:\Users\nguye\Desktop\renpy-8.1.3-sdk\renpy\python.py", line 1122, in py_exec_bytecode
    exec(bytecode, globals, locals)
  File "renpy/common/00keymap.rpy", line 485, in <module>
    python hide:
  File "renpy/common/00keymap.rpy", line 509, in _execute_python_hide
    renpy.save("_reload-1", "reload save game")
  File "C:\Users\nguye\Desktop\renpy-8.1.3-sdk\renpy\loadsave.py", line 432, in save
    reraise(t, e, tb)
  File "/home/tom/ab/renpy-build-fix/tmp/install.linux-x86_64/lib/python3.9/site-packages/future/utils/__init__.py", line 444, in raise_
  File "C:\Users\nguye\Desktop\renpy-8.1.3-sdk\renpy\loadsave.py", line 413, in save
    dump((roots, renpy.game.log), logf)
  File "C:\Users\nguye\Desktop\renpy-8.1.3-sdk\renpy\compat\pickle.py", line 103, in dump
    pickle.dump(o, f, pickle.HIGHEST_PROTOCOL if highest else PROTOCOL)
  File "C:\Users\nguye\Desktop\renpy-8.1.3-sdk\renpy\python.py", line 1219, in module_pickle
    raise Exception("Could not pickle {!r}.".format(module))
Exception: Could not pickle <module 'time' (built-in)>. (perhaps store.time = <module 'time' (built-in)>)

Windows-10-10.0.22621 AMD64
Ren'Py 8.1.3.23091805
Hatsune Miku's Timer 1.0
Sun Dec 31 18:38:22 2023

User avatar
m_from_space
Miko-Class Veteran
Posts: 975
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: could not pickle [module 'time' (built-in)>

#2 Post by m_from_space »

sittingox wrote: Sun Dec 31, 2023 10:41 pm No clue what it means. Thoughts anyone?
Pickling means that Renpy tries to prepare certain data for saving. It's not possible to do this with all stuff, like OS-related file pointers or whatnot. In your case it has a problem with module "time", which is odd, because that shouldn't be a problem. At least not that I am aware of.

What are you doing with module time in your code exactly?

Do you also have this problem when just loading or saving your games or just with the interactive director?

sittingox
Newbie
Posts: 11
Joined: Wed Nov 15, 2023 7:33 pm
Contact:

Re: could not pickle [module 'time' (built-in)>

#3 Post by sittingox »

Looks like I accidentally used module time as a variable. I changed it to a different name and it fixed it.

However, now when I try to reload or use intereactive director I get a possible infinite loop error. I don't get this issue from any other projects I got, so maybe I accidentally messed something up.

What's weird is that the error message keeps changing where the infinite loop line is.

Already tried updating the game to various versions, but doesn't do anything to help.

First error:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 357, in script
    $ renpy.pause(1, hard=True)
Exception: Possible infinite loop.

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

Full traceback:
  File "game/script.rpy", line 357, in script
    $ renpy.pause(1, hard=True)
  File "renpy/execution.py", line 61, in check_infinite_loop
    raise Exception("Possible infinite loop.")
Exception: Possible infinite loop.

Windows-10-10.0.22621 AMD64
Ren'Py 7.6.3.23091805
Hatsune Miku's Timer 1.0
Mon Jan  1 20:01:04 2024


Second error:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 340, in script
    if hour >= 0 and hour < 4:
Exception: Possible infinite loop.

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

Full traceback:
  File "game/script.rpy", line 340, in script
    if hour >= 0 and hour < 4:
  File "renpy/execution.py", line 61, in check_infinite_loop
    raise Exception("Possible infinite loop.")
Exception: Possible infinite loop.

Windows-10-10.0.22621 AMD64
Ren'Py 7.6.3.23091805
Hatsune Miku's Timer 1.0
Mon Jan  1 20:01:40 2024

User avatar
m_from_space
Miko-Class Veteran
Posts: 975
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: could not pickle [module 'time' (built-in)>

#4 Post by m_from_space »

sittingox wrote: Mon Jan 01, 2024 11:40 pm However, now when I try to reload or use intereactive director I get a possible infinite loop error. I don't get this issue from any other projects I got, so maybe I accidentally messed something up.
Make sure to start a completely new game inside your project, not loading an old one (from times you were using the time module in a wrong way). Also you could try and hit "Force Recompile" inside the Renpy GUI as well as "Delete Persistent", before starting your game.

If this doesn't fix anything, you may want to post the code that's part of the error messages - most likely a loop you constructed.

Please also show how exactly you're using module time in your new project!

sittingox
Newbie
Posts: 11
Joined: Wed Nov 15, 2023 7:33 pm
Contact:

Re: could not pickle [module 'time' (built-in)>

#5 Post by sittingox »

I tried force recompile and deleting persistent, but it doesn't help. My project isn't very big, so I think I'll just rebuild it and maybe I'll figure out where the loop is. Thanks for the help though!

WilliamJessie
Newbie
Posts: 3
Joined: Thu Oct 26, 2023 8:51 am

Re: could not pickle [module 'time' (built-in)>

#6 Post by WilliamJessie »

All good now?

User avatar
m_from_space
Miko-Class Veteran
Posts: 975
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: could not pickle [module 'time' (built-in)>

#7 Post by m_from_space »

sittingox wrote: Sun Jan 07, 2024 4:30 pm I tried force recompile and deleting persistent, but it doesn't help. My project isn't very big, so I think I'll just rebuild it and maybe I'll figure out where the loop is. Thanks for the help though!
I'm also interested if you found the issue and what it was.

Post Reply

Who is online

Users browsing this forum: Lacha