ImportError: No module named pkgutil

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
yozayozo
Newbie
Posts: 8
Joined: Sun Sep 19, 2021 10:15 am
Contact:

ImportError: No module named pkgutil

#1 Post by yozayozo »

Having added selenium library for a custom py script inside renpy, the compile on game start causes the following error:
While running game code:
File "game/apo.rpy", line 1, in script
init python:
File "game/apo.rpy", line 1, in script
init python:
File "game/apo.rpy", line 2, in <module>
from selenium import webdriver
ImportError: No module named pkgutil

If Its removed along with its usecases, the game starts normally. Therefore it is the cause of the error.
I have installed other libraries via pip directly inside the game/python-packages. requests and selenium are installed there.

I have searched other posts and saw from Tom that pkgutil should be installed by default or something along those lines.
Has anyone had a similar case, perhaps some solutions?

Additonal info: "apo.rpy" is just a file containing a py script that the game needs. Nothing else. This is the import of the libraries there:

Code: Select all

init python:
    from selenium import webdriver
    import time

Full traceback here:

Code: Select all

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

Full traceback:
  File "renpy/bootstrap.py", line 326, in bootstrap
    renpy.main.main()
  File "renpy/main.py", line 515, in main
    renpy.game.context().run(node)
  File "game/apo.rpy", line 1, in script
    init python:
  File "game/apo.rpy", line 1, in script
    init python:
  File "renpy/ast.py", line 923, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "renpy/python.py", line 2235, in py_exec_bytecode
    exec(bytecode, globals, locals)
  File "game/apo.rpy", line 2, in <module>
    from selenium import webdriver
  File "renpy/loader.py", line 985, in load_module
    exec(code, mod.__dict__)
  File "python-packages/selenium/webdriver/__init__.py", line 18, in <module>
  File "renpy/loader.py", line 985, in load_module
    exec(code, mod.__dict__)
  File "python-packages/selenium/webdriver/firefox/webdriver.py", line 29, in <module>
  File "renpy/loader.py", line 985, in load_module
    exec(code, mod.__dict__)
  File "python-packages/selenium/webdriver/remote/webdriver.py", line 26, in <module>
  File "renpy/loader.py", line 985, in load_module
    exec(code, mod.__dict__)
  File "python-packages/selenium/webdriver/remote/webelement.py", line 21, in <module>
ImportError: No module named pkgutil

Windows-10-10.0.19041
Ren'Py 7.4.8.1895
test_ac 1.0
Sun Sep 19 16:12:15 2021

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: ImportError: No module named pkgutil

#2 Post by PyTom »

I wouldn't expect arbitrary third party modules to work with Ren'Py. Please make sure the packages you use support Ren'Py before you try to import them.
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

yozayozo
Newbie
Posts: 8
Joined: Sun Sep 19, 2021 10:15 am
Contact:

Re: ImportError: No module named pkgutil

#3 Post by yozayozo »

How does one check if a package is supported by Ren'Py?

rayminator
Miko-Class Veteran
Posts: 793
Joined: Fri Feb 09, 2018 12:05 am
Location: Canada
Contact:

Re: ImportError: No module named pkgutil

#4 Post by rayminator »

yozayozo wrote: Tue Sep 21, 2021 8:40 am How does one check if a package is supported by Ren'Py?
contact them and ask them
https://www.selenium.dev/support/

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]